From f7724db62a528be5672b4a2fe3fc4ca37ddc03f0 Mon Sep 17 00:00:00 2001 From: xbgmsharp Date: Fri, 6 Oct 2023 00:05:37 +0200 Subject: [PATCH] Update home dashboard --- grafana/dashboards/home.json | 181 +++++++++++++++++++++++++++-------- 1 file changed, 139 insertions(+), 42 deletions(-) diff --git a/grafana/dashboards/home.json b/grafana/dashboards/home.json index 670174a..9cab30f 100644 --- a/grafana/dashboards/home.json +++ b/grafana/dashboards/home.json @@ -24,8 +24,21 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 7, - "links": [], + "id": 5, + "links": [ + { + "asDropdown": false, + "icon": "external link", + "includeVars": true, + "keepTime": false, + "tags": [], + "targetBlank": true, + "title": "New link", + "tooltip": "", + "type": "dashboards", + "url": "" + } + ], "liveNow": false, "panels": [ { @@ -53,7 +66,7 @@ "showStarred": true, "tags": [] }, - "pluginVersion": "10.1.0", + "pluginVersion": "10.1.4", "tags": [], "targets": [ { @@ -68,12 +81,39 @@ "type": "dashlist" }, { - "autoZoom": true, "datasource": { "type": "postgres", "uid": "PCC52D03280B7034C" }, - "defaultLayer": "OpenStreetMap", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, "gridPos": { "h": 13, "w": 12, @@ -81,11 +121,80 @@ "y": 0 }, "id": 5, - "lineColor": "red", "maxDataPoints": 500, - "pointColor": "royalblue", - "scrollWheelZoom": false, - "showLayerChanger": true, + "options": { + "basemap": { + "config": {}, + "name": "Layer 0", + "type": "default" + }, + "controls": { + "mouseWheelZoom": true, + "showAttribution": true, + "showDebug": false, + "showMeasure": false, + "showScale": false, + "showZoom": true + }, + "layers": [ + { + "config": { + "showLegend": true, + "style": { + "color": { + "fixed": "dark-green" + }, + "opacity": 0.4, + "rotation": { + "fixed": 0, + "max": 360, + "min": -360, + "mode": "mod" + }, + "size": { + "fixed": 5, + "max": 15, + "min": 2 + }, + "symbol": { + "fixed": "img/icons/marker/circle.svg", + "mode": "fixed" + }, + "textConfig": { + "fontSize": 12, + "offsetX": 0, + "offsetY": 0, + "textAlign": "center", + "textBaseline": "middle" + } + } + }, + "filterData": { + "id": "byRefId", + "options": "A" + }, + "location": { + "latitude": "value", + "longitude": "value", + "mode": "auto" + }, + "name": "Boat", + "tooltip": true, + "type": "markers" + } + ], + "tooltip": { + "mode": "details" + }, + "view": { + "allLayers": true, + "id": "fit", + "lat": 0, + "lon": 0, + "zoom": 5 + } + }, + "pluginVersion": "10.1.4", "targets": [ { "datasource": { @@ -95,7 +204,7 @@ "editorMode": "code", "format": "table", "rawQuery": true, - "rawSql": "SELECT \"latitude\" as value, $__time(time) FROM api.metrics WHERE $__timeFilter(time) ORDER BY time ASC;", + "rawSql": "SELECT latitude, longitude FROM api.metrics WHERE vessel_id = '${boat}' ORDER BY time ASC LIMIT 1;", "refId": "A", "sql": { "columns": [ @@ -114,39 +223,10 @@ ], "limit": 50 } - }, - { - "datasource": { - "type": "postgres", - "uid": "PCC52D03280B7034C" - }, - "editorMode": "code", - "format": "table", - "hide": false, - "rawQuery": true, - "rawSql": "SELECT \"longitude\" as value, $__time(time) FROM api.metrics WHERE $__timeFilter(time) ORDER BY time ASC;", - "refId": "B", - "sql": { - "columns": [ - { - "parameters": [], - "type": "function" - } - ], - "groupBy": [ - { - "property": { - "type": "string" - }, - "type": "groupBy" - } - ], - "limit": 50 - } } ], "title": "Location", - "type": "pr0ps-trackmap-panel" + "type": "geomap" } ], "refresh": "", @@ -155,10 +235,27 @@ "style": "dark", "tags": [], "templating": { - "list": [] + "list": [ + { + "definition": "SET \"user.email\" = '${__user.email}';\nSET vessel.id = '${__user.login}';\nSELECT\n v.name AS __text,\n m.vessel_id AS __value\n FROM auth.vessels v\n JOIN api.metadata m ON v.owner_email = '${__user.email}' and m.vessel_id = v.vessel_id;", + "description": "Vessel Name", + "hide": 0, + "includeAll": false, + "label": "Boat", + "multi": false, + "name": "boat", + "options": [], + "query": "SET \"user.email\" = '${__user.email}';\nSET vessel.id = '${__user.login}';\nSELECT\n v.name AS __text,\n m.vessel_id AS __value\n FROM auth.vessels v\n JOIN api.metadata m ON v.owner_email = '${__user.email}' and m.vessel_id = v.vessel_id;", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + } + ] }, "time": { - "from": "now-6h", + "from": "now-90d", "to": "now" }, "timepicker": {