diagnostics: Use new setup mechanism

This commit is contained in:
Sunil Mohan Adapa 2016-02-12 14:42:02 +05:30
parent 68881f720c
commit 28a889c54b
No known key found for this signature in database
GPG Key ID: 36C361440C9BC971
3 changed files with 26 additions and 26 deletions

View File

@ -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 = []

View File

@ -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})

View File

@ -1,4 +1,4 @@
{% extends 'base.html' %}
{% extends 'app.html' %}
{% comment %}
#
# This file is part of Plinth.
@ -29,17 +29,7 @@
{% endblock %}
{% block content %}
<h2>{{ title }}</h2>
<p>
{% 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 %}
</p>
{% block configuration %}
{% if not is_running %}
<form class="form form-diagnostics-button" method="post"