From dd6a03442ee4f988c582db0cfbe582810c730c2e Mon Sep 17 00:00:00 2001 From: Veiko Aasa Date: Sun, 13 Dec 2020 21:15:47 +0200 Subject: [PATCH] diagnostics: Show app name and fallback to app id if not exist Tests performed: - The diagnostics app page and individual app diagnostics pages have app names. - When the app name is missing (the apache app), app id is shown instead. Signed-off-by: Veiko Aasa --- plinth/modules/diagnostics/__init__.py | 2 +- plinth/modules/diagnostics/templates/diagnostics_app.html | 2 +- plinth/modules/diagnostics/views.py | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/plinth/modules/diagnostics/__init__.py b/plinth/modules/diagnostics/__init__.py index 7bbf7d15b..1a3942897 100644 --- a/plinth/modules/diagnostics/__init__.py +++ b/plinth/modules/diagnostics/__init__.py @@ -112,7 +112,7 @@ def run_on_all_enabled_modules(): continue apps.append((app.app_id, app)) - app_name = app.info.name or _('None') + app_name = app.info.name or app.app_id current_results['results'][app.app_id] = {'name': app_name} current_results['apps'] = apps diff --git a/plinth/modules/diagnostics/templates/diagnostics_app.html b/plinth/modules/diagnostics/templates/diagnostics_app.html index 6d74d2f15..b1bd75dd4 100644 --- a/plinth/modules/diagnostics/templates/diagnostics_app.html +++ b/plinth/modules/diagnostics/templates/diagnostics_app.html @@ -9,7 +9,7 @@

{% trans "Diagnostic Results" %}

-

{% blocktrans %}App: {{ app_id }}{% endblocktrans %}

+

{% blocktrans %}App: {{ app_name }}{% endblocktrans %}

{% if results %} {% include "diagnostics_results.html" with results=results %} diff --git a/plinth/modules/diagnostics/views.py b/plinth/modules/diagnostics/views.py index 097e9fc25..8d0a7a778 100644 --- a/plinth/modules/diagnostics/views.py +++ b/plinth/modules/diagnostics/views.py @@ -38,6 +38,7 @@ def diagnose_app(request, app_id): app = App.get(app_id) except KeyError: raise Http404('App does not exist') + app_name = app.info.name or app_id diagnosis = None diagnosis_exception = None @@ -51,7 +52,7 @@ def diagnose_app(request, app_id): return TemplateResponse( request, 'diagnostics_app.html', { 'title': _('Diagnostic Test'), - 'app_id': app_id, + 'app_name': app_name, 'results': diagnosis, 'exception': diagnosis_exception, })