From 408a393f1d2b41b06dda540d8a41b71f57de10af Mon Sep 17 00:00:00 2001 From: Matthew Frost Date: Sun, 19 Nov 2023 17:06:40 +0100 Subject: [PATCH] powerbar.ti --- app/templates/index copy.html | 293 +++++++++++++++++++++ app/templates/index.html | 479 ++++++++++++++-------------------- app/views.py | 13 +- 3 files changed, 508 insertions(+), 277 deletions(-) create mode 100644 app/templates/index copy.html diff --git a/app/templates/index copy.html b/app/templates/index copy.html new file mode 100644 index 0000000..cdc73d8 --- /dev/null +++ b/app/templates/index copy.html @@ -0,0 +1,293 @@ + + + + Powerbar.ti + + + + + + +

Powerbar.ti (0.1.4)

+
+
+ +
+
+
+ +
+
+ + + + + + diff --git a/app/templates/index.html b/app/templates/index.html index cdc73d8..049f5e0 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -1,293 +1,220 @@ - + - Powerbar.ti - - - - + + + -

Powerbar.ti (0.1.4)

-
-
- + +
+

powerbar.ti (0.0.5)

+
+
+ +
+
+
+
+ + +
+
-
-
-
- - + +
+
+ + {% for powerbar in powerbars.items() %} +
+
+
+ +

{{powerbar[1].name}}

+ + +
    + {% for outlet in powerbar[1].outlets.items() %} + +
  • +
    +
    {{outlet[1].name}}
    +
    + +
    +
    +
  • + {% endfor %} +
+ + +
+
+ +
+ {% endfor %} +
+
+ + + + + + + + + + + + + diff --git a/app/views.py b/app/views.py index 508cbe5..96cb984 100644 --- a/app/views.py +++ b/app/views.py @@ -29,7 +29,18 @@ def vaild_outlet (powerbar, outlet): @routes.route('/') def home(): - return render_template('index.html') + + all_groups = [] + + for powerbar in powerbars: + for outlet in powerbars[powerbar]['outlets']: + powerbars[powerbar]['outlets'][outlet]['state'] = powerbars[powerbar]['outlets'][outlet].get('state', 'unknown') + + for group in powerbars[powerbar]['groups']: + all_groups.append(group) + + + return render_template('index.html', powerbars=powerbars, all_groups=all_groups)