From c13e2105da40219065d5ab0ba28e876b75423d07 Mon Sep 17 00:00:00 2001 From: Matthew Stratford Date: Sun, 18 Apr 2021 22:23:25 +0100 Subject: [PATCH] Add nice quit and restarting pages. --- ui-templates/base.html | 2 ++ ui-templates/message.html | 29 +++++++++++++++++++++++++++++ web_server.py | 22 ++++++++++++++++++++-- 3 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 ui-templates/message.html diff --git a/ui-templates/base.html b/ui-templates/base.html index b86c7e3..546f75c 100644 --- a/ui-templates/base.html +++ b/ui-templates/base.html @@ -34,6 +34,7 @@

BAPSicle

+ {% if data.ui_menu is undefined or data.ui_menu is true %}
Status @@ -48,6 +49,7 @@ Logs
+ {% endif %}
{% block content %} diff --git a/ui-templates/message.html b/ui-templates/message.html new file mode 100644 index 0000000..d329cd8 --- /dev/null +++ b/ui-templates/message.html @@ -0,0 +1,29 @@ +{% extends 'base.html' %} +{% block content_inner %} +
+

{{ data.title }}

+

{{ data.message }}

+
+{% if data.redirect_to %} + +{% endif %} +{% endblock %} diff --git a/web_server.py b/web_server.py index 6df7449..9ec7cc5 100644 --- a/web_server.py +++ b/web_server.py @@ -338,13 +338,31 @@ def status(channel: int): @app.route("/quit") def quit(request): server_state.update("running_state", "quitting") - return text("Server quitting...") + + data = { + "ui_page": "message", + "ui_title": "Quitting BAPSicle", + "title": "See you later!", + "ui_menu": False, + "message": "BAPSicle is going back into winter hibernation, see you again soon!" + } + return render_template("message.html", data) @app.route("/restart") def restart(request): server_state.update("running_state", "restarting") - return text("Server restarting...") + + data = { + "ui_page": "message", + "ui_title": "Restarting BAPSicle", + "title": "Please Wait...", + "ui_menu": False, + "message": "Just putting BAPSicle back in the freezer for a moment!", + "redirect_to": "/", + "redirect_wait_ms": 10000 + } + return render_template("message.html", data) # Don't use reloader, it causes Nested Processes!