diff --git a/modules/installed/system/diagnostics.py b/modules/installed/system/diagnostics.py index 6de341079..db05738a2 100644 --- a/modules/installed/system/diagnostics.py +++ b/modules/installed/system/diagnostics.py @@ -19,7 +19,7 @@ Plinth module for running diagnostics """ -import os, cherrypy +import cherrypy from gettext import gettext as _ from auth import require from plugin_mount import PagePlugin @@ -38,13 +38,8 @@ class diagnostics(PagePlugin): @cherrypy.expose @require() def index(self): - main = _(""" -
The system diagnostic test will run a number of checks on your - system to confirm that network services are running and configured - properly. It may take a minute to complete.
- """) - main += '' - return util.render_template(title=_("System Diagnostics"), main=main) + return util.render_template(template='diagnostics', + title=_('System Diagnostics')) class test(PagePlugin): order = 31 @@ -55,17 +50,8 @@ class test(PagePlugin): @cherrypy.expose @require() def index(self): - main = '' output, error = actions.superuser_run("diagnostic-test") - - if error: - main += _("The diagnostic test encountered an error:") - for line in error.split('\n'): - main += line + "" - - if output: - main += _("Output of diagnostic test:") - for line in output.split('\n'): - main += line + "" - - return util.render_template(title=_("Diagnostic Test"), main=main) + return util.render_template(template='diagnostics_test', + title=_('Diagnostic Test'), + diagnostics_output=output, + diagnostics_error=error) diff --git a/modules/installed/system/templates/diagnostics.html b/modules/installed/system/templates/diagnostics.html new file mode 100644 index 000000000..f8acb5bcb --- /dev/null +++ b/modules/installed/system/templates/diagnostics.html @@ -0,0 +1,13 @@ +{% extends 'login_nav.html' %} + +{% block main_block %} + +The system diagnostic test will run a number of checks on your +system to confirm that network services are running and configured +properly. It may take a minute to complete.
+ + + +{% endblock %} diff --git a/modules/installed/system/templates/diagnostics_test.html b/modules/installed/system/templates/diagnostics_test.html new file mode 100644 index 000000000..adca2bb8d --- /dev/null +++ b/modules/installed/system/templates/diagnostics_test.html @@ -0,0 +1,15 @@ +{% extends 'login_nav.html' %} + +{% block main_block %} + +{% if diagnostics_error %} +The diagnostic test encountered an error:
+
{{ diagnostics_error }}
+{% endif %}
+
+{% if diagnostics_output %}
+ Output of diagnostic test:
+{{ diagnostics_output }}
+{% endif %}
+
+{% endblock %}