mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-03-11 09:04:54 +00:00
Convert diagnostics pages to template
This commit is contained in:
parent
eff6306f7d
commit
25fe3c7ee8
@ -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 = _("""
|
||||
<p>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.</p>
|
||||
""")
|
||||
main += '<p><a class="btn btn-primary btn-large" href="'+cfg.server_dir+'/sys/diagnostics/test">Run diagnostic test »</a></p>'
|
||||
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:</br>")
|
||||
for line in error.split('\n'):
|
||||
main += line + "</br>"
|
||||
|
||||
if output:
|
||||
main += _("Output of diagnostic test:</br>")
|
||||
for line in output.split('\n'):
|
||||
main += line + "</br>"
|
||||
|
||||
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)
|
||||
|
||||
13
modules/installed/system/templates/diagnostics.html
Normal file
13
modules/installed/system/templates/diagnostics.html
Normal file
@ -0,0 +1,13 @@
|
||||
{% extends 'login_nav.html' %}
|
||||
|
||||
{% block main_block %}
|
||||
|
||||
<p>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.</p>
|
||||
|
||||
<p><a class="btn btn-primary btn-large"
|
||||
href="{{ basehref }}/sys/diagnostics/test">Run diagnostic test
|
||||
»</a></p>
|
||||
|
||||
{% endblock %}
|
||||
15
modules/installed/system/templates/diagnostics_test.html
Normal file
15
modules/installed/system/templates/diagnostics_test.html
Normal file
@ -0,0 +1,15 @@
|
||||
{% extends 'login_nav.html' %}
|
||||
|
||||
{% block main_block %}
|
||||
|
||||
{% if diagnostics_error %}
|
||||
<p>The diagnostic test encountered an error:<p>
|
||||
<pre>{{ diagnostics_error }}</pre>
|
||||
{% endif %}
|
||||
|
||||
{% if diagnostics_output %}
|
||||
<p>Output of diagnostic test:</p>
|
||||
<pre>{{ diagnostics_output }}</pre>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
Loading…
x
Reference in New Issue
Block a user