Add information about enabled services to front page

This commit is contained in:
James Valleroy authored and Sunil Mohan Adapa committed 2016-09-02 20:03:39 +05:30
1 parent fa0bc7471f
commit 49eadd971a
9 files changed
+176 -13

No files matched your search

+23 -1
View File
@@ -24,6 +24,7 @@ from django.utils.translation import ugettext_lazy as _
from plinth import actions
from plinth import action_utils
from plinth import cfg
from plinth import frontpage
from plinth import service as service_module
from plinth.views import ServiceView
@@ -69,7 +70,10 @@ def init():
global service
service = service_module.Service(
managed_services[0], title, ports=['sip-plinth', 'sip-tls-plinth'],
is_external=True)
is_external=True, enable=enable, disable=disable)
if service.is_enabled():
add_shortcut()
class ReproServiceView(ServiceView):
@@ -83,6 +87,24 @@ def setup(helper, old_version=None):
helper.install(managed_packages)
helper.call('post', actions.superuser_run, 'repro', ['setup'])
helper.call('post', service.notify_enabled, None, True)
helper.call('post', add_shortcut)
def add_shortcut():
frontpage.add_shortcut('repro', title, '?selected=repro',
'glyphicon-phone-alt', description)
def enable():
"""Enable the module."""
actions.superuser_run('service', ['enable', managed_services[0]])
add_shortcut()
def disable():
"""Disable the module."""
actions.superuser_run('service', ['disable', managed_services[0]])
frontpage.remove_shortcut('repro')
def diagnose():