diff --git a/plinth/modules/diagnostics/__init__.py b/plinth/modules/diagnostics/__init__.py index 0009438b9..0285270a2 100644 --- a/plinth/modules/diagnostics/__init__.py +++ b/plinth/modules/diagnostics/__init__.py @@ -126,6 +126,7 @@ def _run_on_all_enabled_modules(): app_results = { 'diagnosis': None, 'exception': None, + 'show_rerun_setup': False, } try: @@ -135,6 +136,11 @@ def _run_on_all_enabled_modules(): exception) app_results['exception'] = str(exception) + for check in app_results['diagnosis']: + if check.result in [Result.FAILED, Result.WARNING]: + app_results['show_rerun_setup'] = True + break + with results_lock: current_results['results'][app_id].update(app_results) current_results['progress_percentage'] = \ diff --git a/plinth/modules/diagnostics/templates/diagnostics_app.html b/plinth/modules/diagnostics/templates/diagnostics_app.html index b1bd75dd4..ba2eb77e7 100644 --- a/plinth/modules/diagnostics/templates/diagnostics_app.html +++ b/plinth/modules/diagnostics/templates/diagnostics_app.html @@ -9,7 +9,18 @@

{% trans "Diagnostic Results" %}

-

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

+
+

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

+ + {% if show_rerun_setup %} +
+ {% csrf_token %} + +
+ {% endif %} +
{% if results %} {% include "diagnostics_results.html" with results=results %} diff --git a/plinth/modules/diagnostics/templates/diagnostics_full.html b/plinth/modules/diagnostics/templates/diagnostics_full.html index a6e59ebef..836abd505 100644 --- a/plinth/modules/diagnostics/templates/diagnostics_full.html +++ b/plinth/modules/diagnostics/templates/diagnostics_full.html @@ -33,11 +33,22 @@ {% if results %}

{% trans "Results" %}

{% for app_id, app_data in results.results.items %} -

- {% blocktrans with app_name=app_data.name %} - App: {{app_name}} - {% endblocktrans %} -

+
+

+ {% blocktrans with app_name=app_data.name %} + App: {{app_name}} + {% endblocktrans %} +

+ + {% if app_data.show_rerun_setup %} +
+ {% csrf_token %} + +
+ {% endif %} +
{% if app_data.diagnosis %} {% include "diagnostics_results.html" with results=app_data.diagnosis %} diff --git a/plinth/modules/diagnostics/views.py b/plinth/modules/diagnostics/views.py index 7b1c0830a..a7006b886 100644 --- a/plinth/modules/diagnostics/views.py +++ b/plinth/modules/diagnostics/views.py @@ -17,6 +17,8 @@ from plinth.app import App from plinth.modules import diagnostics from plinth.views import AppView +from .check import Result + logger = logging.getLogger(__name__) @@ -87,10 +89,18 @@ def diagnose_app(request, app_id): exception) diagnosis_exception = str(exception) + show_rerun_setup = False + for check in diagnosis: + if check.result in [Result.FAILED, Result.WARNING]: + show_rerun_setup = True + break + return TemplateResponse( request, 'diagnostics_app.html', { 'title': _('Diagnostic Test'), + 'app_id': app_id, 'app_name': app_name, 'results': diagnosis, 'exception': diagnosis_exception, + 'show_rerun_setup': show_rerun_setup, })