From 117ccbace2d60368e2321d0091eff6e97a3b3eb0 Mon Sep 17 00:00:00 2001 From: Ole Artz Date: Fri, 4 Aug 2017 14:51:40 +0200 Subject: [PATCH] DASH: severity as stylesheet class --- python_suite/dashboard/dashboard.py | 7 +++++++ python_suite/dashboard/static/css/style.css | 3 +++ python_suite/dashboard/views/pv_overview.jinja2 | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/python_suite/dashboard/dashboard.py b/python_suite/dashboard/dashboard.py index 9f88114..2941d06 100755 --- a/python_suite/dashboard/dashboard.py +++ b/python_suite/dashboard/dashboard.py @@ -16,6 +16,13 @@ def index(): for pv in group['PVs']: p = epics.PV(pv['name']) p.get_ctrlvars() + class_map = { + epics.NO_ALARM : "", + epics.MINOR_ALARM : "minor_alarm", + epics.MAJOR_ALARM : "major_alarm", + epics.INVALID_ALARM : "invalid_alarm", + } + pv['classes'] = class_map[p.severity] if 'enum' in p.type: pv['value'] = p.get(as_string=True) else: diff --git a/python_suite/dashboard/static/css/style.css b/python_suite/dashboard/static/css/style.css index f02c8be..521017b 100644 --- a/python_suite/dashboard/static/css/style.css +++ b/python_suite/dashboard/static/css/style.css @@ -21,3 +21,6 @@ .Cooling table, th { text-align: left; } +.invalid_alarm { + background-color: red; +} diff --git a/python_suite/dashboard/views/pv_overview.jinja2 b/python_suite/dashboard/views/pv_overview.jinja2 index 8bcdb40..e91946e 100644 --- a/python_suite/dashboard/views/pv_overview.jinja2 +++ b/python_suite/dashboard/views/pv_overview.jinja2 @@ -30,7 +30,7 @@ {% for PV in group.PVs %} {{ PV.name }} - {{ PV.value }} + {{ PV.value }} {{ PV.unit }} {% endfor %} -- 2.43.0