mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-04-15 09:51:21 +00:00
diagnostics: Use new setup mechanism
This commit is contained in:
parent
68881f720c
commit
28a889c54b
@ -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 = []
|
||||
|
||||
@ -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})
|
||||
|
||||
|
||||
@ -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"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user