From b44231ac84d46b6c62fb2c2428ac3f58fbc8d267 Mon Sep 17 00:00:00 2001 From: DrMichael Date: Tue, 13 Oct 2020 16:58:45 +0200 Subject: [PATCH] Added links Statistics again (#973) * Added links again I moved the should be invisible fields to the far right and minimised them... As soon as that is fixed in Grafana, we can just make them invisible. The only thing, which is not optimal, is, that the fields with mi and F show up at the far right. No idea, how to address that... * And changed timezone back to current_setting Given, that it can be set via PGTZ. * Added panel title Otherwise you cannot sort by clicking the column header... * Make time zone configurable again; preselect current TZ Co-authored-by: Adrian Kumpf --- grafana/dashboards/statistics.json | 104 +++++++++++++++++++++-------- 1 file changed, 77 insertions(+), 27 deletions(-) diff --git a/grafana/dashboards/statistics.json b/grafana/dashboards/statistics.json index 300900bc60..f58ac728bf 100644 --- a/grafana/dashboards/statistics.json +++ b/grafana/dashboards/statistics.json @@ -15,7 +15,7 @@ "editable": true, "gnetId": null, "graphTooltip": 0, - "iteration": 1601808426715, + "iteration": 1601887874542, "links": [ { "icon": "dashboard", @@ -114,6 +114,16 @@ { "id": "custom.width", "value": 195 + }, + { + "id": "links", + "value": [ + { + "targetBlank": true, + "title": "Trip", + "url": "d/FkUpJpQZk/trip?orgId=1&from=${__data.fields.date_from}&to=${__data.fields.date_to}" + } + ] } ] }, @@ -165,7 +175,13 @@ }, { "id": "links", - "value": [] + "value": [ + { + "targetBlank": true, + "title": "Charging stats", + "url": "d/-pkIkhmRz/charging-stats?orgId=1&from=${__data.fields.date_from}&to=${__data.fields.date_to}" + } + ] }, { "id": "unit", @@ -209,7 +225,13 @@ "properties": [ { "id": "links", - "value": [] + "value": [ + { + "targetBlank": true, + "title": "Charges", + "url": "d/TSmNYvRRk/charges?orgId=1&from=${__data.fields.date_from}&to=${__data.fields.date_to}" + } + ] } ] }, @@ -221,7 +243,13 @@ "properties": [ { "id": "links", - "value": [] + "value": [ + { + "targetBlank": true, + "title": "Drives", + "url": "d/Y8upc6ZRk/drives?orgId=1&from=${__data.fields.date_from}&to=${__data.fields.date_to}" + } + ] } ] }, @@ -362,6 +390,30 @@ "value": "fahrenheit" } ] + }, + { + "matcher": { + "id": "byName", + "options": "date_from" + }, + "properties": [ + { + "id": "custom.width", + "value": 25 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "date_to" + }, + "properties": [ + { + "id": "custom.width", + "value": 26 + } + ] } ] }, @@ -478,7 +530,7 @@ ], "timeFrom": null, "timeShift": null, - "title": "", + "title": "per ${period}", "transformations": [ { "id": "merge", @@ -500,20 +552,20 @@ "timezone": true }, "indexByName": { - "avg_consumption_kwh": 10, - "avg_outside_temp_c": 6, - "cnt": 7, - "cnt_charges": 12, - "cost_charges": 11, - "date": 3, - "date_from": 1, - "date_to": 2, + "avg_consumption_kwh": 8, + "avg_outside_temp_c": 4, + "cnt": 5, + "cnt_charges": 10, + "cost_charges": 9, + "date": 1, + "date_from": 12, + "date_to": 13, "display": 0, - "efficiency": 8, - "efficiency_net_km": 13, - "sum_consumption_kwh": 9, - "sum_distance_km": 5, - "sum_duration_h": 4 + "efficiency": 6, + "efficiency_net_km": 11, + "sum_consumption_kwh": 7, + "sum_distance_km": 3, + "sum_duration_h": 2 }, "renameByName": { "avg_consumption_kwh": "Avg charged", @@ -521,9 +573,9 @@ "cnt": "# drives", "cnt_charges": "# charges", "cost_charges": "Costs", - "date": "", - "date_from": "Starting at", - "date_to": "Ending at", + "date": "Starting at", + "date_from": "", + "date_to": "", "display": "Period", "efficiency": "Efficiency", "efficiency_net_km": "", @@ -691,21 +743,19 @@ { "allValue": null, "current": { - "selected": true, - "text": "GMT", - "value": "GMT" + "selected": false }, "datasource": "TeslaMate", - "definition": "select name from pg_timezone_names where name like 'posix/%';", + "definition": "select current_setting('TIMEZONE'), replace(name, 'posix/', '') from pg_timezone_names where name like 'posix/%';", "hide": 0, "includeAll": false, "label": "Time zone", "multi": false, "name": "timezone", "options": [], - "query": "select name from pg_timezone_names where name like 'posix/%';", + "query": "select current_setting('TIMEZONE'), replace(name, 'posix/', '') from pg_timezone_names where name like 'posix/%';", "refresh": 1, - "regex": "/posix\\/(.*)/", + "regex": "", "skipUrlSync": false, "sort": 0, "tagValuesQuery": "",