Skip to content
Snippets Groups Projects
Commit 5c0e7864 authored by Bjarke Madsen's avatar Bjarke Madsen
Browse files

add templating changes for service-based dashboards

parent 3794a4a2
No related branches found
Tags 0.20
No related merge requests found
from typing import Dict, List
from brian_dashboard_manager.templating.helpers import get_dashboard_data
def get_panel_data(services):
result: Dict[str, List[Dict]] = {}
for service in services:
customers = service.get('customers')
name = service.get('name')
sid = service.get('sid')
scid = service.get('scid')
measurement = 'scid_rates'
title = f'{name} ({sid})'
for customer in customers:
result.setdefault(customer, []).append({
'measurement': measurement,
'title': title,
'scid': scid,
'has_v6': False
})
return result
def create_service_panels(services, datasource):
panel_data = get_panel_data(services)
for dash in get_dashboard_data(
data=panel_data,
datasource=datasource,
tag='SERVICE'):
yield dash
......@@ -79,6 +79,13 @@
"operator": "=",
"value": "{{ subscription }}"
}
{% elif scid %}
{
"condition": null,
"key": "scid",
"operator": "=",
"value": "{{ scid }}"
}
{% else %}
{
"condition": null,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment