app: Refactor all apps to use the Info component

- Remove the need to pass all the individual information elements to the AppView
  separately. This eliminates many issues with elements that were mistakenly not
  sent to AppView. Also reduces a lot of code duplication.

- Create App classes for power and sso for consistency.

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa authored and James Valleroy committed 2020-02-16 18:22:01 -05:00
1 parent 67a216ba18
commit b576a77c3d
112 files changed
+862 -1041

No files matched your search

+18 -19
View File
@@ -35,19 +35,11 @@ from .forms import is_repo_url
from .manifest import (GIT_REPO_PATH, # noqa, pylint: disable=unused-import
backup, clients)
clients = clients
version = 1
managed_packages = ['gitweb', 'highlight']
name = _('Gitweb')
icon_filename = 'gitweb'
short_description = _('Simple Git Hosting')
description = [
_description = [
_('Git is a distributed version-control system for tracking changes in '
'source code during software development. Gitweb provides a web '
'interface to Git repositories. You can browse history and content of '
@@ -59,8 +51,6 @@ description = [
'<a href="https://git-scm.com/docs/gittutorial">Git tutorial</a>.')
]
manual_page = 'GitWeb'
group = ('git-access', _('Read-write access to Git repositories'))
app = None
@@ -77,19 +67,28 @@ class GitwebApp(app_module.App):
self.repos = []
menu_item = menu.Menu('menu-gitweb', name, short_description, 'gitweb',
'gitweb:index', parent_url_name='apps')
info = app_module.Info(app_id=self.app_id, version=version,
name=_('Gitweb'), icon_filename='gitweb',
short_description=_('Simple Git Hosting'),
description=_description, manual_page='GitWeb',
clients=clients)
self.add(info)
menu_item = menu.Menu('menu-gitweb', info.name, info.short_description,
info.icon_filename, 'gitweb:index',
parent_url_name='apps')
self.add(menu_item)
shortcut = frontpage.Shortcut('shortcut-gitweb', name,
short_description=short_description,
icon=icon_filename, url='/gitweb/',
clients=clients, login_required=True,
shortcut = frontpage.Shortcut('shortcut-gitweb', info.name,
short_description=info.short_description,
icon=info.icon_filename, url='/gitweb/',
clients=info.clients,
login_required=True,
allowed_groups=[group[0]])
self.add(shortcut)
firewall = Firewall('firewall-gitweb', name, ports=['http', 'https'],
is_external=True)
firewall = Firewall('firewall-gitweb', info.name,
ports=['http', 'https'], is_external=True)
self.add(firewall)
webserver = Webserver('webserver-gitweb', 'gitweb-freedombox',
+1 -6
View File
@@ -37,14 +37,9 @@ from .forms import CreateRepoForm, EditRepoForm
class GitwebAppView(views.AppView):
"""Serve configuration page."""
clients = gitweb.clients
name = gitweb.name
description = gitweb.description
app_id = 'gitweb'
show_status_block = False
template_name = 'gitweb_configure.html'
icon_filename = gitweb.icon_filename
manual_page = gitweb.manual_page
def get_context_data(self, *args, **kwargs):
"""Add repositories to the context data."""
@@ -163,6 +158,6 @@ def delete(request, name):
return redirect(reverse_lazy('gitweb:index'))
return TemplateResponse(request, 'gitweb_delete.html', {
'title': gitweb.name,
'title': gitweb.app.info.name,
'name': name
})