diff --git a/plinth/modules/diagnostics/__init__.py b/plinth/modules/diagnostics/__init__.py index 294d3f884..f532db3ee 100644 --- a/plinth/modules/diagnostics/__init__.py +++ b/plinth/modules/diagnostics/__init__.py @@ -19,15 +19,32 @@ Plinth module for system diagnostics """ -from . import diagnostics -from .diagnostics import init -from plinth import action_utils +from django.utils.translation import ugettext_lazy as _ -__all__ = ['diagnostics', 'init'] +from plinth import action_utils +from plinth import cfg + +version = 1 + +is_essential = True + +title = _('Diagnostics') + +description = [ + _('The system diagnostic test will run a number of checks on your ' + 'system to confirm that applications and services are working as ' + 'expected.') +] depends = ['system'] +def init(): + """Initialize the module""" + menu = cfg.main_menu.get('system:index') + menu.add_urlname(title, 'glyphicon-screenshot', 'diagnostics:index', 30) + + def diagnose(): """Run diagnostics and return the results.""" results = [] diff --git a/plinth/modules/diagnostics/diagnostics.py b/plinth/modules/diagnostics/diagnostics.py index 4ce058e09..a44539afe 100644 --- a/plinth/modules/diagnostics/diagnostics.py +++ b/plinth/modules/diagnostics/diagnostics.py @@ -24,12 +24,11 @@ from django.http import Http404 from django.template.response import TemplateResponse from django.views.decorators.http import require_POST from django.utils.translation import ugettext_lazy as _ -import importlib import logging import threading -from plinth import cfg from plinth import module_loader +from plinth.modules import diagnostics logger = logging.Logger(__name__) @@ -39,20 +38,14 @@ current_results = {} _running_task = None -def init(): - """Initialize the module""" - menu = cfg.main_menu.get('system:index') - menu.add_urlname(_('Diagnostics'), 'glyphicon-screenshot', - 'diagnostics:index', 30) - - def index(request): """Serve the index page""" if request.method == 'POST' and not _running_task: _start_task() return TemplateResponse(request, 'diagnostics.html', - {'title': _('System Diagnostics'), + {'title': diagnostics.title, + 'description': diagnostics.description, 'is_running': _running_task is not None, 'results': current_results}) diff --git a/plinth/modules/diagnostics/templates/diagnostics.html b/plinth/modules/diagnostics/templates/diagnostics.html index 2b369732e..066222347 100644 --- a/plinth/modules/diagnostics/templates/diagnostics.html +++ b/plinth/modules/diagnostics/templates/diagnostics.html @@ -1,4 +1,4 @@ -{% extends 'base.html' %} +{% extends 'app.html' %} {% comment %} # # This file is part of Plinth. @@ -29,17 +29,7 @@ {% endblock %} -{% block content %} - -
- {% blocktrans trimmed %} - The system diagnostic test will run a number of checks on your - system to confirm that applications and services are working as - expected. - {% endblocktrans %} -
+{% block configuration %} {% if not is_running %}