From d6d6ca4c43e15b178dd28ea1d3143a1ae1a4b237 Mon Sep 17 00:00:00 2001 From: Philipp Klaus Date: Mon, 18 Sep 2017 11:40:54 +0200 Subject: [PATCH] DASH: new Bootstrap based layout in addition --- python_suite/dashboard/dashboard.py | 7 ++ python_suite/dashboard/static/css/style.css | 18 ++-- .../dashboard/views/base_bootstrap.jinja2 | 83 +++++++++++++++++++ .../views/pv_overview_bootstrap.jinja2 | 74 +++++++++++++++++ 4 files changed, 177 insertions(+), 5 deletions(-) create mode 100644 python_suite/dashboard/views/base_bootstrap.jinja2 create mode 100644 python_suite/dashboard/views/pv_overview_bootstrap.jinja2 diff --git a/python_suite/dashboard/dashboard.py b/python_suite/dashboard/dashboard.py index c06ba5f..d7710a5 100755 --- a/python_suite/dashboard/dashboard.py +++ b/python_suite/dashboard/dashboard.py @@ -173,6 +173,13 @@ def json_replace_nan(): def index(): redirect('/list/general_overview') +@route('/list_bs/') +@view('pv_overview_bootstrap.jinja2') +def list_pvs_bs(page): + if page not in CONFIG['pages']: + return abort(404, 'Page not found') + return {'config': CONFIG, 'req_page': page} + @route('/list/') @view('pv_overview.jinja2') def list_pvs(page): diff --git a/python_suite/dashboard/static/css/style.css b/python_suite/dashboard/static/css/style.css index eebc06e..6c7f55d 100644 --- a/python_suite/dashboard/static/css/style.css +++ b/python_suite/dashboard/static/css/style.css @@ -104,7 +104,11 @@ div.error { .invalid_alarm .indicator, .minor_alarm .indicator, .major_alarm .indicator, -.disconnected .indicator { +.disconnected .indicator, +.invalid_alarm.indicator, +.minor_alarm.indicator, +.major_alarm.indicator, +.disconnected.indicator { border: 4px solid; } @@ -113,7 +117,8 @@ div.error { content: "- invalid -"; color: #0091FF; } -.invalid_alarm .indicator { +.invalid_alarm .indicator, +.invalid_alarm.indicator { border-color: #0091FF; } @@ -122,7 +127,8 @@ div.error { content: "- MINOR -"; color: #FF6F00; } -.minor_alarm .indicator { +.minor_alarm .indicator, +.minor_alarm.indicator { border-color: #FF6F00; } @@ -131,7 +137,8 @@ div.error { content: "- MAJOR -"; color: #FF0000; } -.major_alarm .indicator { +.major_alarm .indicator, +.major_alarm.indicator { border-color: #FF0000; } @@ -140,7 +147,8 @@ div.error { content: "- disconnected -"; color: #FF0000; } -.disconnected .indicator { +.disconnected .indicator, +.disconnected.indicator { border-color: #EBFF00; } diff --git a/python_suite/dashboard/views/base_bootstrap.jinja2 b/python_suite/dashboard/views/base_bootstrap.jinja2 new file mode 100644 index 0000000..bf7cad1 --- /dev/null +++ b/python_suite/dashboard/views/base_bootstrap.jinja2 @@ -0,0 +1,83 @@ + + + + {% block title %}{% endblock %} - DASHBOARD + + + + + + + + + + + + + {% block header %} + + {% endblock %} + + + + +
+ +
+

{{ page_title }}

+ +
+ {% block content %}{% endblock %} + +
+ + + + + + + + + + + + diff --git a/python_suite/dashboard/views/pv_overview_bootstrap.jinja2 b/python_suite/dashboard/views/pv_overview_bootstrap.jinja2 new file mode 100644 index 0000000..e379369 --- /dev/null +++ b/python_suite/dashboard/views/pv_overview_bootstrap.jinja2 @@ -0,0 +1,74 @@ +{% extends "base_bootstrap.jinja2" %} + +{% block title %}{{ config.pages[req_page].name }}{% endblock %} + +{% block header %} + + + + + +{% endblock %} + +{% block content %} +
+ {% set page = config.pages[req_page] %} + {% for group in page.groups %} + {% set this_group = config.groups[group] %} +
+

{{ this_group.name }}

+ {% for pv_name in this_group.PVs %} + {% set PV = config.PVs[config.PV_lookup[pv_name]] %} + {% if loop.index0 % 3 == 0 %} +
+ {% endif %} +
+
+
+
{{ PV.name }}
+
+ + {% if 'switch' in PV.classes %} + + {% else %} + {% if PV.precision is number %} + {{ ("%."+PV.precision|string +"f") % PV.value }} + {% else %} + {{ PV.value }} + {% endif %} + {% endif %} + + {{ PV.unit }} +
+
+
+
+ {% if (loop.index0 % 3 == 2) or loop.last %} +
+ {% endif %} + {% endfor %} +
+ {% endfor %} +
+{% endblock %} + + +{% block js_end_of_page %} +/* +$(function() { + // on page load + updateSparklines(); +}); +*/ +updateSparklines(); +{% endblock %} -- 2.43.0