Allow multi mode for timeseries
Temporary until I think of something better.
This commit is contained in:
parent
55a86772e0
commit
32b9f8eeed
16
dashboard.py
16
dashboard.py
|
@ -21,6 +21,22 @@ class Dashboard:
|
|||
self.widgets = []
|
||||
for w in d["widgets"]:
|
||||
if w["type"] == "timeseries":
|
||||
# XXX - currently just a copy of the gauge code,
|
||||
# but I want to add support for timeseries graphs with
|
||||
# multiple series later so this will change
|
||||
if w.get("multi"):
|
||||
ts_list = LTS.find(w["data"][0])
|
||||
for ts in ts_list:
|
||||
tso = LTS(id=ts)
|
||||
if not tso.data:
|
||||
log.warning("%s has no data: Skipping", tso.id)
|
||||
continue
|
||||
if tso.data[-1][0] < time.time() - 86400:
|
||||
log.info("%s too old; Skipping", tso.id)
|
||||
continue
|
||||
w1 = {**w, "data": [ts]}
|
||||
self.widgets.append(TimeSeries(w1))
|
||||
else:
|
||||
self.widgets.append(TimeSeries(w))
|
||||
elif w["type"] == "gauge":
|
||||
if w.get("multi"):
|
||||
|
|
Loading…
Reference in New Issue