Added an about page (#251)

This page was added since it is sometimes difficult to say which version
was deployed on an server. This should allow an easy lookup on the
server and make it comparable with what is expected.
This commit is contained in:
2023-10-26 17:32:17 +02:00
committed by GitHub
parent 6d77867eb5
commit 896136dcee
2 changed files with 63 additions and 0 deletions

View File

@ -0,0 +1,48 @@
"""A page giving some details about this application including versioning."""
import os
from functools import lru_cache
from importlib.metadata import metadata
from typing import Final
import dash
from dash import html
from aki_prj23_transparenzregister.ui import header_elements
dash.register_page(__name__, path_template="/about/", title="About")
_DISTRIBUTION_METADATA = metadata("aki-prj23-transparenzregister")
__author__: Final[str] = _DISTRIBUTION_METADATA["Author"]
__email__: Final[str] = _DISTRIBUTION_METADATA["Author-email"]
__version__: Final[str] = _DISTRIBUTION_METADATA["Version"]
@lru_cache
def layout() -> list[html]:
"""Defines the layout of the about page.
Returns:
A list of html element making up this page.
"""
return [
header_elements.create_selection_header("About"),
html.H3("About Us"),
html.H3("Description"),
html.P(_DISTRIBUTION_METADATA["Summary"]),
html.H3("Key Features"),
html.Ul(
[
html.Li("Some feature."),
]
),
html.H3("Version"),
html.Ul(
[
html.Li(f"Software Version: {__version__}"),
html.Li(
f"Build from GiT Revision: {os.getenv('GIT_HASH', 'Running locally'), }"
),
]
),
]

15
tests/ui/about_test.py Normal file
View File

@ -0,0 +1,15 @@
"""Tests if the about page can be created."""
from dash.development.base_component import Component
from aki_prj23_transparenzregister.ui import app
from aki_prj23_transparenzregister.ui.pages import about
_ = app
def test_layout() -> None:
"""Checks if the about page can be created."""
result = about.layout()
assert isinstance(result, list)
for e in result:
assert isinstance(e, Component)