From e4c9b33778a74dd0c786cb3e6eaf8c0f78cb31c1 Mon Sep 17 00:00:00 2001 From: Daniel Markstedt Date: Sun, 29 Oct 2023 16:16:05 +0900 Subject: [PATCH] Web UI: Create a system settings page --- .../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 | 38 +++- python/web/src/templates/admin.html | 194 ++++++++++++++++++ python/web/src/templates/base.html | 51 +---- python/web/src/templates/index.html | 104 ---------- python/web/src/web.py | 29 ++- 8 files changed, 257 insertions(+), 162 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 00000000..b53410ad --- /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 00000000..448e1485 --- /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 00000000..e4d75595 --- /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 f91e9752..6f27b534 100644 --- a/python/web/src/static/themes/modern/style.css +++ b/python/web/src/static/themes/modern/style.css @@ -423,8 +423,8 @@ div.header div.authentication-disabled a { color: #fff; } - div.header div.login-status.logged-in a { - background: var(--danger) no-repeat right 0.5rem center; + div.header div.login-status.logged-in span.log-out-button a { + background: var(--primary) no-repeat right 0.5rem center; background-image: url("icons/log-out.svg"); background-size: var(--icon-size); border-radius: var(--border-radius); @@ -434,6 +434,17 @@ div.header div.authentication-disabled a { color: #fff; } + div.header div.login-status.logged-in span.admin-button a { + background: var(--secondary) no-repeat right 0.5rem center; + background-image: url("icons/command.svg"); + background-size: var(--icon-size); + border-radius: var(--border-radius); + padding: 0.25rem 2.25rem 0.25rem 0.75rem; + display: inline-block; + text-decoration: none; + color: #fff; + } + div.header div.login-status.logged-in span.logged-in-as-text { margin-right: 1rem; } @@ -958,6 +969,29 @@ section#manual 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 00000000..dd6d77e7 --- /dev/null +++ b/python/web/src/templates/admin.html @@ -0,0 +1,194 @@ +{% 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 6d61e93e..4ebdfd6a 100644 --- a/python/web/src/templates/base.html +++ b/python/web/src/templates/base.html @@ -32,7 +32,9 @@
{{ _("Logged in as %(username)s", username=env["username"]) }} - - {{ _("Log Out") }} + {{ _("Log Out") }} + - + {{ _("Settings") }}
{% else %}
@@ -104,53 +106,6 @@ {% block content %}{% endblock content %}