fix: make view responsible for App Info field/values
that does not belong in the template, so custom apps can extend the list easier
This commit is contained in:
parent
55a97211c1
commit
c4f735fda8
2 changed files with 80 additions and 25 deletions
|
|
@ -7,30 +7,11 @@
|
|||
<p class="panel-heading">Application</p>
|
||||
<div class="panel-block">
|
||||
<div style="width: 100%;">
|
||||
<b-field horizontal label="Distribution">
|
||||
<span>${app.get_distribution() or f'?? - set config for `{app.appname}.app_dist`'}</span>
|
||||
</b-field>
|
||||
<b-field horizontal label="Version">
|
||||
<span>${app.get_version() or f'?? - set config for `{app.appname}.app_dist`'}</span>
|
||||
</b-field>
|
||||
<b-field horizontal label="App Title">
|
||||
<span>${app.get_title()}</span>
|
||||
</b-field>
|
||||
<b-field horizontal label="Node Title">
|
||||
<span>${app.get_node_title()}</span>
|
||||
</b-field>
|
||||
<b-field horizontal label="DB Backend">
|
||||
<span>${config.appdb_engine.dialect.name}</span>
|
||||
</b-field>
|
||||
<b-field horizontal label="Time Zone">
|
||||
<span>${app.get_timezone_name()}</span>
|
||||
</b-field>
|
||||
<b-field horizontal label="Production Mode">
|
||||
<span>${"Yes" if config.production() else "No"}</span>
|
||||
</b-field>
|
||||
<b-field horizontal label="Email Enabled">
|
||||
<span>${"Yes" if app.get_email_handler().sending_is_enabled() else "No"}</span>
|
||||
% for key, info in (appinfo or {}).items():
|
||||
<b-field horizontal label="${info['label']}">
|
||||
<span>${info["value"]}</span>
|
||||
</b-field>
|
||||
% endfor
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# wuttaweb -- Web App for Wutta Framework
|
||||
# Copyright © 2024-2025 Lance Edgar
|
||||
# Copyright © 2024-2026 Lance Edgar
|
||||
#
|
||||
# This file is part of Wutta Framework.
|
||||
#
|
||||
|
|
@ -73,6 +73,80 @@ class AppInfoView(MasterView): # pylint: disable=abstract-method
|
|||
# TODO: for tailbone backward compat with get_liburl() etc.
|
||||
weblib_config_prefix = None
|
||||
|
||||
def get_template_context(self, context): # pylint: disable=empty-docstring
|
||||
""" """
|
||||
if self.listing:
|
||||
context["appinfo"] = self.get_appinfo_dict()
|
||||
return context
|
||||
|
||||
def get_appinfo_dict(self): # pylint: disable=missing-function-docstring
|
||||
return OrderedDict(
|
||||
[
|
||||
(
|
||||
"distribution",
|
||||
{
|
||||
"label": "Distribution",
|
||||
"value": self.app.get_distribution()
|
||||
or f"?? - set config for `{self.app.appname}.app_dist`",
|
||||
},
|
||||
),
|
||||
(
|
||||
"version",
|
||||
{
|
||||
"label": "Version",
|
||||
"value": self.app.get_version()
|
||||
or f"?? - set config for `{self.app.appname}.app_dist`",
|
||||
},
|
||||
),
|
||||
(
|
||||
"app_title",
|
||||
{
|
||||
"label": "App Title",
|
||||
"value": self.app.get_title(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"node_title",
|
||||
{
|
||||
"label": "Node Title",
|
||||
"value": self.app.get_node_title(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"db_backend",
|
||||
{
|
||||
"label": "DB Backend",
|
||||
"value": self.config.appdb_engine.dialect.name,
|
||||
},
|
||||
),
|
||||
(
|
||||
"timezone",
|
||||
{
|
||||
"label": "Timezone",
|
||||
"value": self.app.get_timezone_name(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"production",
|
||||
{
|
||||
"label": "Production Mode",
|
||||
"value": "Yes" if self.config.production() else "No",
|
||||
},
|
||||
),
|
||||
(
|
||||
"email_enabled",
|
||||
{
|
||||
"label": "Email Enabled",
|
||||
"value": (
|
||||
"Yes"
|
||||
if self.app.get_email_handler().sending_is_enabled()
|
||||
else "No"
|
||||
),
|
||||
},
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
def get_grid_data( # pylint: disable=empty-docstring
|
||||
self, columns=None, session=None
|
||||
):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue