From cbc5a9f9127fc670120faa282d4ed98081a51951 Mon Sep 17 00:00:00 2001 From: Daniel Markstedt Date: Mon, 25 Sep 2023 23:41:35 -0700 Subject: [PATCH] Web UI: Create a system admin page and move options there --- .../static/themes/modern/icons/cloud-off.svg | 1 + .../src/static/themes/modern/icons/cloud.svg | 1 + .../static/themes/modern/icons/command.svg | 1 + python/web/src/static/themes/modern/style.css | 44 ++++ python/web/src/templates/admin.html | 190 ++++++++++++++++++ python/web/src/templates/base.html | 47 ----- python/web/src/templates/index.html | 104 +--------- python/web/src/web.py | 29 ++- 8 files changed, 260 insertions(+), 157 deletions(-) create mode 100644 python/web/src/static/themes/modern/icons/cloud-off.svg create mode 100644 python/web/src/static/themes/modern/icons/cloud.svg create mode 100644 python/web/src/static/themes/modern/icons/command.svg create mode 100644 python/web/src/templates/admin.html diff --git a/python/web/src/static/themes/modern/icons/cloud-off.svg b/python/web/src/static/themes/modern/icons/cloud-off.svg new file mode 100644 index 0000000000..b53410adfa --- /dev/null +++ b/python/web/src/static/themes/modern/icons/cloud-off.svg @@ -0,0 +1 @@ + diff --git a/python/web/src/static/themes/modern/icons/cloud.svg b/python/web/src/static/themes/modern/icons/cloud.svg new file mode 100644 index 0000000000..448e1485bb --- /dev/null +++ b/python/web/src/static/themes/modern/icons/cloud.svg @@ -0,0 +1 @@ + diff --git a/python/web/src/static/themes/modern/icons/command.svg b/python/web/src/static/themes/modern/icons/command.svg new file mode 100644 index 0000000000..d2778fa6f2 --- /dev/null +++ b/python/web/src/static/themes/modern/icons/command.svg @@ -0,0 +1 @@ + diff --git a/python/web/src/static/themes/modern/style.css b/python/web/src/static/themes/modern/style.css index a21a91ed96..750c8b8064 100644 --- a/python/web/src/static/themes/modern/style.css +++ b/python/web/src/static/themes/modern/style.css @@ -954,6 +954,50 @@ section#manual a p { margin: 0; } +/* + ------------------------------------------------------------------------------ + Index > Section: Admin + ------------------------------------------------------------------------------ + */ +section#admin { + margin: 2rem 0 1rem; +} + +section#admin a { + margin: auto; + display: block; + padding: 0.25rem 0 0.25rem 2rem; + background: url("icons/command.svg") no-repeat left center; + font-weight: bold; +} + +section#admin a p { + margin: 0; +} + +/* + ------------------------------------------------------------------------------ + Admin > Section: Services + ------------------------------------------------------------------------------ + */ +section#services ul { + list-style: none; + padding-left: 0; +} + +section#services li { + margin-bottom: 0.5em; + padding: 0.25rem 0 0.25rem 2rem; +} + +section#services li.enabled { + background: url("icons/cloud.svg") no-repeat left center; +} + +section#services li.disabled { + background: url("icons/cloud-off.svg") no-repeat left center; +} + /* ------------------------------------------------------------------------------ Drives page diff --git a/python/web/src/templates/admin.html b/python/web/src/templates/admin.html new file mode 100644 index 0000000000..9730a1efac --- /dev/null +++ b/python/web/src/templates/admin.html @@ -0,0 +1,190 @@ +{% extends "base.html" %} +{% block content %} + +
+
+ + {{ _("Logging") }} + +
    +
  • {{ _("The current dropdown selection indicates the active log level.") }}
  • +
+
+ +
+
+ + + + + +
+
+ +
+
+ + + +
+
+
+ +
+ +
+
+ + {{ _("Appearance") }} + +
    +
  • {{ _("Theme and language are auto-detected for your user agent. Here you can change the default.") }}
  • +
  • {{ _("The System Name is the \"pretty\" hostname if set, with a fallback to the regular hostname.") }}
  • +
+
+ +
+
+ {{ _("The current theme is %(theme)s.", theme=current_theme) }} + {% if current_theme == "classic" %} + {{ _('Switch to the %(theme)s theme', theme="modern") }} + {% else %} + {{ _('Switch to the %(theme)s theme', theme="classic") }} + {% endif %} +
+ +
+ + + +
+
+ +
+
+ + + +
+
+ + +
+
+
+ +
+ +
+
+ + {{ _("Companion Services") }} + +
    +
  • {{ _("If you want to add a service, run the easyinstall.sh script and choose the one to install.") }}
  • +
  • {{ _("In order to manage the services in the Web UI, you may install Webmin as well.") }}
  • +
+
+
+ +
+ +
+
+ + {{ _("System Operations") }} + +
    +
  • {{ _("IMPORTANT: Always shut down the system before turning off the power. Failing to do so may lead to data loss.") }}
  • +
+
+ +
+
+ +
+
+ +
+
+
+ +

{{ _("Go to Home") }}

+ +{% endblock content %} diff --git a/python/web/src/templates/base.html b/python/web/src/templates/base.html index 38cbe09ba1..258bd4405b 100644 --- a/python/web/src/templates/base.html +++ b/python/web/src/templates/base.html @@ -104,53 +104,6 @@

{% block content %}{% endblock content %}