From 2a615229f4449b63e9751b205804694c232a72df Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Mon, 6 Dec 2021 11:24:15 +0000 Subject: [PATCH] system: Add an about page with software versions Signed-off-by: Michael Tremer --- Makefile.am | 5 +++++ src/templates/system/about.html | 24 ++++++++++++++++++++++++ src/westferry/handlers/system.py | 21 +++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 src/templates/system/about.html diff --git a/Makefile.am b/Makefile.am index 249b878..2f4983b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -177,6 +177,11 @@ dist_templates_modules_menus_DATA = \ src/templates/modules/menus/sidebar.html \ src/templates/modules/menus/topbar.html +dist_templates_system_DATA = \ + src/templates/system/about.html + +templates_systemdir = $(templatesdir)/system + ui_modulesdir = $(datadir)/westferry/templates/modules ui_modules_DATA = diff --git a/src/templates/system/about.html b/src/templates/system/about.html new file mode 100644 index 0000000..c91e572 --- /dev/null +++ b/src/templates/system/about.html @@ -0,0 +1,24 @@ +{% extends "../base.html" %} + +{% block main %} +

{{ _("About") }}

+ + {% for header in tables %} + + + + + + + + + {% for key in tables[header] %} + + + + + {% end %} + +
{{ header }}
{{ key }}{{ tables[header][key] }}
+ {% end %} +{% end block %} diff --git a/src/westferry/handlers/system.py b/src/westferry/handlers/system.py index 2be82c4..d2eb2f4 100644 --- a/src/westferry/handlers/system.py +++ b/src/westferry/handlers/system.py @@ -21,6 +21,7 @@ from . import base from .. import ui +from ..constants import PACKAGE_NAME, PACKAGE_VERSION from ..i18n import N_ class BaseHandler(base.BaseHandler): @@ -36,6 +37,9 @@ class BaseHandler(base.BaseHandler): # Settings menu.add_handler(SettingsHandler) + # About + menu.add_handler(AboutHandler) + return menu @@ -63,3 +67,20 @@ class SettingsHandler(BaseHandler): form = tab.add_form() form.add_text_input("hostname", _("Hostname"), object=self.backend.system) + + +class AboutHandler(BaseHandler): + title = N_("About") + url = r"/system/about" + + def get(self): + _ = self.locale.translate + + tables = { + _("Software Versions") : { + PACKAGE_NAME : PACKAGE_VERSION, + _("systemd") : self.backend.system.systemd.Version, + } + } + + self.render("system/about.html", tables=tables) -- 2.47.3