3
0
Fork 0

feat: add basic App Info view (index only)

more to come!
This commit is contained in:
Lance Edgar 2024-08-05 21:49:18 -05:00
parent 9ac4f7525e
commit 9a739381ae
13 changed files with 192 additions and 5 deletions

View file

@ -118,8 +118,9 @@ class MenuHandler(GenericHandler):
'type': 'menu',
'items': [
{
'title': "TODO!",
'url': '#',
'title': "App Info",
'route': 'appinfo',
'perm': 'appinfo.list',
},
],
}

View file

@ -249,6 +249,7 @@ def before_render(event):
context['h'] = helpers
context['url'] = request.route_url
context['json'] = json
context['b'] = 'o' if request.use_oruga else 'b' # for buefy
# TODO: this should be avoided somehow, for non-traditional web
# apps, esp. "API" web apps. (in the meantime can configure the

View file

@ -0,0 +1,56 @@
## -*- coding: utf-8; -*-
<%inherit file="/master/index.mako" />
<%def name="page_content()">
<nav class="panel item-panel">
<p class="panel-heading">Application</p>
<div class="panel-block">
<div style="width: 100%;">
<b-field horizontal label="Distribution">
<span>${app.get_distribution(obj=app.get_web_handler()) or f'?? - set config for `{app.appname}.app_dist`'}</span>
</b-field>
<b-field horizontal label="Version">
<span>${app.get_version(obj=app.get_web_handler()) 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>
</div>
</div>
</nav>
<nav class="panel item-panel">
<p class="panel-heading">Configuration Files</p>
<div class="panel-block">
<div style="width: 100%;">
<${b}-table :data="configFiles">
<${b}-table-column field="priority"
label="Priority"
v-slot="props">
{{ props.row.priority }}
</${b}-table-column>
<${b}-table-column field="path"
label="File Path"
v-slot="props">
{{ props.row.path }}
</${b}-table-column>
</${b}-table>
</div>
</div>
</nav>
</%def>
<%def name="modify_this_page_vars()">
${parent.modify_this_page_vars()}
<script>
ThisPageData.configFiles = ${json.dumps([dict(path=p, priority=i) for i, p in enumerate(config.get_prioritized_files(), 1)])|n}
</script>
</%def>
${parent.body()}

View file

@ -1,6 +1,10 @@
## -*- coding: utf-8; -*-
<%inherit file="/page.mako" />
<%def name="title()">${index_title}</%def>
<%def name="content_title()"></%def>
<%def name="page_content()">
<p>TODO: index page content</p>
</%def>

View file

@ -39,6 +39,7 @@ def defaults(config, **kwargs):
config.include(mod('wuttaweb.views.auth'))
config.include(mod('wuttaweb.views.common'))
config.include(mod('wuttaweb.views.settings'))
def includeme(config):

View file

@ -0,0 +1,47 @@
# -*- coding: utf-8; -*-
################################################################################
#
# wuttaweb -- Web App for Wutta Framework
# Copyright © 2024 Lance Edgar
#
# This file is part of Wutta Framework.
#
# Wutta Framework is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# Wutta Framework is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# Wutta Framework. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
"""
Views for app settings
"""
from wuttaweb.views import MasterView
class AppInfoView(MasterView):
"""
Master view for the overall app, to show/edit config etc.
"""
model_name = 'AppInfo'
model_title_plural = "App Info"
route_prefix = 'appinfo'
def defaults(config, **kwargs):
base = globals()
AppInfoView = kwargs.get('AppInfoView', base['AppInfoView'])
AppInfoView.defaults(config)
def includeme(config):
defaults(config)