{
  "uid": "zvenoai-status",
  "title": "Статус ZvenoAI",
  "description": "Сводка https://status.zveno.ai/status.json, контракт version 1",
  "tags": ["zvenoai"],
  "editable": true,
  "graphTooltip": 0,
  "refresh": "2m",
  "schemaVersion": 42,
  "time": {"from": "now-1h", "to": "now"},
  "timepicker": {"refresh_intervals": ["2m", "5m", "15m", "30m"]},
  "timezone": "browser",
  "links": [
    {"title": "status.zveno.ai", "type": "link", "url": "https://status.zveno.ai", "targetBlank": true, "icon": "external link", "tags": [], "asDropdown": false, "includeVars": false, "keepTime": false, "tooltip": ""}
  ],
  "annotations": {"list": []},
  "templating": {
    "list": [
      {
        "type": "datasource",
        "name": "datasource",
        "label": "Источник данных",
        "query": "yesoreyeram-infinity-datasource",
        "current": {"text": "ZvenoAI status", "value": "zvenoai-status"},
        "hide": 0,
        "refresh": 1,
        "regex": "",
        "includeAll": false,
        "multi": false,
        "options": []
      }
    ]
  },
  "panels": [
    {
      "id": 1,
      "type": "stat",
      "title": "Общий статус",
      "gridPos": {"h": 5, "w": 8, "x": 0, "y": 0},
      "datasource": {"type": "yesoreyeram-infinity-datasource", "uid": "${datasource}"},
      "targets": [
        {
          "refId": "A",
          "datasource": {"type": "yesoreyeram-infinity-datasource", "uid": "${datasource}"},
          "type": "json",
          "source": "url",
          "url": "https://status.zveno.ai/status.json",
          "url_options": {"method": "GET", "data": ""},
          "parser": "jq-backend",
          "format": "table",
          "root_selector": "if now - (.updated | fromdateiso8601) > 300 then .status = \"unknown\" | .components[].status = \"unknown\" else . end",
          "columns": [
            {"selector": "status", "text": "status", "type": "string"},
            {"selector": "components.api.status", "text": "api", "type": "string"},
            {"selector": "components.site.status", "text": "site", "type": "string"}
          ],
          "filters": []
        }
      ],
      "options": {
        "reduceOptions": {"values": false, "calcs": ["lastNotNull"], "fields": "/^status$/"},
        "orientation": "auto",
        "textMode": "value",
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "center",
        "wideLayout": true,
        "showPercentChange": false
      },
      "fieldConfig": {
        "defaults": {
          "thresholds": {"mode": "absolute", "steps": [{"color": "#8e8e8e", "value": null}]},
          "mappings": [
            {
              "type": "value",
              "options": {
                "operational": {"text": "Работает", "color": "green", "index": 0},
                "degraded": {"text": "Работает со сбоями", "color": "yellow", "index": 1},
                "down": {"text": "Недоступен", "color": "red", "index": 2},
                "unknown": {"text": "Неизвестно", "color": "#8e8e8e", "index": 3}
              }
            }
          ]
        },
        "overrides": []
      }
    },
    {
      "id": 2,
      "type": "stat",
      "title": "API",
      "gridPos": {"h": 5, "w": 8, "x": 8, "y": 0},
      "datasource": {"type": "datasource", "uid": "-- Dashboard --"},
      "targets": [
        {"refId": "A", "datasource": {"type": "datasource", "uid": "-- Dashboard --"}, "panelId": 1}
      ],
      "options": {
        "reduceOptions": {"values": false, "calcs": ["lastNotNull"], "fields": "/^api$/"},
        "orientation": "auto",
        "textMode": "value",
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "center",
        "wideLayout": true,
        "showPercentChange": false
      },
      "fieldConfig": {
        "defaults": {
          "thresholds": {"mode": "absolute", "steps": [{"color": "#8e8e8e", "value": null}]},
          "mappings": [
            {
              "type": "value",
              "options": {
                "operational": {"text": "Работает", "color": "green", "index": 0},
                "degraded": {"text": "Работает со сбоями", "color": "yellow", "index": 1},
                "down": {"text": "Недоступен", "color": "red", "index": 2},
                "unknown": {"text": "Неизвестно", "color": "#8e8e8e", "index": 3}
              }
            }
          ]
        },
        "overrides": []
      }
    },
    {
      "id": 3,
      "type": "stat",
      "title": "Сайт",
      "gridPos": {"h": 5, "w": 8, "x": 16, "y": 0},
      "datasource": {"type": "datasource", "uid": "-- Dashboard --"},
      "targets": [
        {"refId": "A", "datasource": {"type": "datasource", "uid": "-- Dashboard --"}, "panelId": 1}
      ],
      "options": {
        "reduceOptions": {"values": false, "calcs": ["lastNotNull"], "fields": "/^site$/"},
        "orientation": "auto",
        "textMode": "value",
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "center",
        "wideLayout": true,
        "showPercentChange": false
      },
      "fieldConfig": {
        "defaults": {
          "thresholds": {"mode": "absolute", "steps": [{"color": "#8e8e8e", "value": null}]},
          "mappings": [
            {
              "type": "value",
              "options": {
                "operational": {"text": "Работает", "color": "green", "index": 0},
                "degraded": {"text": "Работает со сбоями", "color": "yellow", "index": 1},
                "down": {"text": "Недоступен", "color": "red", "index": 2},
                "unknown": {"text": "Неизвестно", "color": "#8e8e8e", "index": 3}
              }
            }
          ]
        },
        "overrides": []
      }
    },
    {
      "id": 4,
      "type": "table",
      "title": "Открытые инциденты",
      "gridPos": {"h": 8, "w": 24, "x": 0, "y": 5},
      "datasource": {"type": "yesoreyeram-infinity-datasource", "uid": "${datasource}"},
      "targets": [
        {
          "refId": "B",
          "datasource": {"type": "yesoreyeram-infinity-datasource", "uid": "${datasource}"},
          "type": "json",
          "source": "url",
          "url": "https://status.zveno.ai/status.json",
          "url_options": {"method": "GET", "data": ""},
          "parser": "jq-backend",
          "format": "table",
          "root_selector": ".incidents | map(.components |= join(\", \"))",
          "columns": [
            {"selector": "title", "text": "Инцидент", "type": "string"},
            {"selector": "components", "text": "Компоненты", "type": "string"},
            {"selector": "impact", "text": "Влияние", "type": "string"},
            {"selector": "status", "text": "Статус", "type": "string"},
            {"selector": "started", "text": "Начало", "type": "timestamp"},
            {"selector": "updated", "text": "Обновлён", "type": "timestamp"}
          ],
          "filters": []
        }
      ],
      "transformations": [
        {
          "id": "organize",
          "options": {"indexByName": {"Инцидент": 0, "Компоненты": 1, "Влияние": 2, "Статус": 3, "Начало": 4, "Обновлён": 5}}
        }
      ],
      "options": {"showHeader": true, "cellHeight": "sm"},
      "fieldConfig": {
        "defaults": {"noValue": "Открытых инцидентов нет"},
        "overrides": [
          {
            "matcher": {"id": "byName", "options": "Инцидент"},
            "properties": [{"id": "custom.width", "value": 480}]
          },
          {
            "matcher": {"id": "byName", "options": "Влияние"},
            "properties": [
              {"id": "custom.cellOptions", "value": {"type": "color-text"}},
              {
                "id": "mappings",
                "value": [
                  {
                    "type": "value",
                    "options": {
                      "minor": {"text": "Работает с перебоями", "color": "yellow", "index": 0},
                      "major": {"text": "Частичный сбой", "color": "orange", "index": 1},
                      "critical": {"text": "Недоступен", "color": "red", "index": 2}
                    }
                  }
                ]
              }
            ]
          },
          {
            "matcher": {"id": "byName", "options": "Статус"},
            "properties": [
              {
                "id": "mappings",
                "value": [
                  {
                    "type": "value",
                    "options": {
                      "investigating": {"text": "Выясняем", "index": 0},
                      "identified": {"text": "Причина найдена", "index": 1},
                      "monitoring": {"text": "Наблюдаем", "index": 2}
                    }
                  }
                ]
              }
            ]
          }
        ]
      }
    }
  ]
}
