views: Don't require sending diagnostics module name separately

- Reuse the app_id already available to the view.

- Implement automatically detecting if an app has implemented diagnostics.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa authored and James Valleroy committed 2019-12-30 11:38:02 -05:00
1 parent 636aa05b66
commit f65b4ec407
36 files changed
+12 -39

No files matched your search

-1
View File
@@ -31,7 +31,6 @@ from .forms import BindForm
class BindAppView(AppView): # pylint: disable=too-many-ancestors
"""A specialized view for configuring Bind."""
app_id = 'bind'
diagnostics_module_name = 'bind'
name = name
description = description
show_status_block = True
-1
View File
@@ -27,7 +27,6 @@ class CockpitAppView(AppView):
app_id = 'cockpit'
name = name
description = description
diagnostics_module_name = 'cockpit'
show_status_block = True
clients = clients
manual_page = manual_page
-1
View File
@@ -35,7 +35,6 @@ class CoquelicotAppView(views.AppView):
clients = clients
name = name
description = description
diagnostics_module_name = 'coquelicot'
app_id = 'coquelicot'
form_class = CoquelicotForm
show_status_block = True
-1
View File
@@ -37,7 +37,6 @@ class DateTimeAppView(AppView):
description = datetime.description
form_class = DateTimeForm
app_id = 'datetime'
diagnostics_module_name = 'datetime'
manual_page = datetime.manual_page
def get_initial(self):
-1
View File
@@ -27,7 +27,6 @@ urlpatterns = [
url(
r'^apps/deluge/$',
AppView.as_view(name=deluge.name, description=deluge.description,
diagnostics_module_name='deluge',
clients=deluge.clients, app_id='deluge',
manual_page=deluge.manual_page,
icon_filename=deluge.icon_filename), name='index'),
-1
View File
@@ -60,7 +60,6 @@ class DiasporaAppView(AppView):
form_class = DiasporaAppForm
app_id = 'diaspora'
template_name = 'diaspora-post-setup.html'
diagnostics_module_name = 'diaspora'
name = diaspora.name
def dispatch(self, request, *args, **kwargs):
-1
View File
@@ -34,7 +34,6 @@ class EjabberdAppView(AppView):
template_name = 'ejabberd.html'
name = ejabberd.name
description = ejabberd.description
diagnostics_module_name = 'ejabberd'
form_class = EjabberdForm
manual_page = ejabberd.manual_page
port_forwarding_info = ejabberd.port_forwarding_info
-1
View File
@@ -40,7 +40,6 @@ class GitwebAppView(views.AppView):
clients = gitweb.clients
name = gitweb.name
description = gitweb.description
diagnostics_module_name = 'gitweb'
app_id = 'gitweb'
show_status_block = False
template_name = 'gitweb_configure.html'
-1
View File
@@ -44,7 +44,6 @@ class I2PAppView(AppView):
clients = i2p.clients
name = i2p.name
description = i2p.description
diagnostics_module_name = i2p.service_name
show_status_block = True
template_name = 'i2p.html'
icon_filename = i2p.icon_filename
-1
View File
@@ -35,7 +35,6 @@ class IkiwikiAppView(views.AppView):
app_id = 'ikiwiki'
name = ikiwiki.name
description = ikiwiki.description
diagnostics_module_name = 'ikiwiki'
show_status_block = False
template_name = 'ikiwiki_configure.html'
manual_page = ikiwiki.manual_page
-1
View File
@@ -102,7 +102,6 @@ def init():
class InfinotedAppView(AppView):
app_id = 'infinoted'
diagnostics_module_name = 'infinoted'
name = name
description = description
clients = clients
+2 -1
View File
@@ -38,11 +38,12 @@ def index(request):
status = letsencrypt.get_status()
return TemplateResponse(
request, 'letsencrypt.html', {
'app_id': 'letsencrypt',
'name': letsencrypt.name,
'description': letsencrypt.description,
'status': status,
'manual_page': letsencrypt.manual_page,
'diagnostics_module_name': 'letsencrypt',
'has_diagnostics': True,
'is_enabled': letsencrypt.app.is_enabled(),
})
-1
View File
@@ -65,7 +65,6 @@ class MatrixSynapseAppView(AppView):
template_name = 'matrix-synapse.html'
name = matrixsynapse.name
description = matrixsynapse.description
diagnostics_module_name = 'matrixsynapse'
form_class = MatrixSynapseForm
port_forwarding_info = matrixsynapse.port_forwarding_info
icon_filename = matrixsynapse.icon_filename
-1
View File
@@ -37,7 +37,6 @@ class MediaWikiAppView(views.AppView):
clients = mediawiki.clients
name = mediawiki.name
description = mediawiki.description
diagnostics_module_name = 'mediawiki'
app_id = 'mediawiki'
form_class = MediaWikiForm
manual_page = mediawiki.manual_page
-1
View File
@@ -32,7 +32,6 @@ from .forms import MinetestForm
class MinetestAppView(AppView): # pylint: disable=too-many-ancestors
"""A specialized view for configuring minetest."""
app_id = 'minetest'
diagnostics_module_name = 'minetest'
name = minetest.name
description = description
show_status_block = True
-1
View File
@@ -34,7 +34,6 @@ class MiniDLNAAppView(AppView):
name = minidlna.name
description = minidlna.description
form_class = MiniDLNAServerForm
diagnostics_module_name = 'minidlna'
icon_filename = minidlna.icon_filename
def get_initial(self):
-1
View File
@@ -27,7 +27,6 @@ urlpatterns = [
url(
r'^apps/mldonkey/$',
AppView.as_view(app_id='mldonkey', name=mldonkey.name,
diagnostics_module_name='mldonkey',
description=mldonkey.description,
clients=mldonkey.clients,
manual_page=mldonkey.manual_page,
-1
View File
@@ -26,7 +26,6 @@ from plinth.views import AppView
class MumbleAppView(AppView):
app_id = 'mumble'
diagnostics_module_name = 'mumble'
name = name
description = description
clients = clients
+2 -1
View File
@@ -39,11 +39,12 @@ def index(request):
return TemplateResponse(
request, 'connections_list.html', {
'app_id': 'networks',
'title': _('Network Connections'),
'name': networks.name,
'description': networks.description,
'manual_page': networks.manual_page,
'diagnostics_module_name': 'networks',
'has_diagnostics': True,
'is_enabled': True,
'connections': connections
})
+2 -1
View File
@@ -58,6 +58,7 @@ def index(request):
return TemplateResponse(
request, 'openvpn.html', {
'app_id': 'openvpn',
'clients': openvpn.clients,
'name': openvpn.name,
'description': openvpn.description,
@@ -67,7 +68,7 @@ def index(request):
'form': form,
'show_status_block': True,
'is_running': status['is_running'],
'diagnostics_module_name': 'openvpn',
'has_diagnostics': True,
'is_enabled': status['enabled'],
'icon_filename': openvpn.icon_filename
})
-1
View File
@@ -122,7 +122,6 @@ def setup(helper, old_version=None):
class PrivoxyAppView(AppView):
app_id = 'privoxy'
diagnostics_module_name = 'privoxy'
name = name
description = description
manual_page = manual_page
-1
View File
@@ -23,7 +23,6 @@ from .forms import QuasselForm
class QuasselAppView(AppView):
app_id = 'quassel'
diagnostics_module_name = 'quassel'
name = quassel.name
description = quassel.description
clients = quassel.clients
-1
View File
@@ -34,7 +34,6 @@ class RadicaleAppView(AppView):
clients = radicale.clients
name = radicale.name
description = description
diagnostics_module_name = 'radicale'
form_class = RadicaleForm
app_id = 'radicale'
manual_page = radicale.manual_page
-1
View File
@@ -122,7 +122,6 @@ class ReproAppView(AppView):
clients = clients
name = name
description = description
diagnostics_module_name = 'repro'
app_id = 'repro'
manual_page = manual_page
port_forwarding_info = port_forwarding_info
-1
View File
@@ -27,7 +27,6 @@ urlpatterns = [
url(
r'^apps/roundcube/$',
AppView.as_view(app_id='roundcube', name=roundcube.name,
diagnostics_module_name='roundcube',
description=roundcube.description,
show_status_block=False, clients=roundcube.clients,
manual_page=roundcube.manual_page,
-1
View File
@@ -39,7 +39,6 @@ class SambaAppView(views.AppView):
"""Samba sharing basic configuration."""
name = samba.name
description = samba.description
diagnostics_module_name = 'samba'
app_id = 'samba'
template_name = 'samba.html'
icon_filename = samba.icon_filename
-1
View File
@@ -33,7 +33,6 @@ class SearxAppView(views.AppView):
clients = searx.clients
name = searx.name
description = searx.description
diagnostics_module_name = 'searx'
app_id = 'searx'
form_class = SearxForm
show_status_block = False
-1
View File
@@ -33,7 +33,6 @@ from .forms import ShadowsocksForm
class ShadowsocksAppView(views.AppView):
"""Configuration view for Shadowsocks local socks5 proxy."""
app_id = 'shadowsocks'
diagnostics_module_name = 'shadowsocks'
form_class = ShadowsocksForm
name = shadowsocks.name
description = shadowsocks.description
-1
View File
@@ -27,7 +27,6 @@ urlpatterns = [
url(
r'^apps/syncthing/$',
AppView.as_view(app_id='syncthing', name=syncthing.name,
diagnostics_module_name='syncthing',
description=syncthing.description,
clients=syncthing.clients,
manual_page=syncthing.manual_page,
-1
View File
@@ -55,7 +55,6 @@ class TahoeAppView(AppView):
template_name = 'tahoe-post-setup.html'
name = tahoe.name
description = tahoe.description
diagnostics_module_name = 'tahoe'
port_forwarding_info = tahoe.port_forwarding_info
icon_filename = tahoe.icon_filename
+2 -1
View File
@@ -52,6 +52,7 @@ def index(request):
return TemplateResponse(
request, 'tor.html', {
'app_id': 'tor',
'name': tor.name,
'description': tor.description,
'clients': tor.clients,
@@ -60,7 +61,7 @@ def index(request):
'config_running': bool(config_process),
'form': form,
'firewall': tor.app.get_components_of_type(Firewall),
'diagnostics_module_name': 'tor',
'has_diagnostics': True,
'is_enabled': status['enabled'],
'show_status_block': True,
'is_running': status['is_running'],
-1
View File
@@ -39,7 +39,6 @@ class TransmissionAppView(views.AppView):
clients = transmission.clients
name = transmission.name
description = transmission.description
diagnostics_module_name = 'transmission'
form_class = TransmissionForm
app_id = 'transmission'
manual_page = transmission.manual_page
-1
View File
@@ -27,7 +27,6 @@ urlpatterns = [
url(
r'^apps/ttrss/$',
AppView.as_view(app_id='ttrss', name=ttrss.name,
diagnostics_module_name='ttrss',
description=ttrss.description, clients=ttrss.clients,
icon_filename=ttrss.icon_filename,
manual_page=ttrss.manual_page, show_status_block=True),
-1
View File
@@ -76,7 +76,6 @@ class UserList(AppView, ContextMixin, django.views.generic.ListView):
description = users.description
app_id = 'users'
show_status_block = False
diagnostics_module_name = 'users'
manual_page = users.manual_page
def get_context_data(self, *args, **kwargs):