mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
Add information about enabled services to front page
This commit is contained in:
1 parent
fa0bc7471f
commit
49eadd971a
9 files changed
+176
-13
No files matched your search
@@ -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.utils import format_lazy
|
||||
from plinth.views import ServiceView
|
||||
@@ -66,7 +67,11 @@ def init():
|
||||
|
||||
global service
|
||||
service = service_module.Service(
|
||||
managed_services[0], title, ports=['privoxy'], is_external=False)
|
||||
managed_services[0], title, ports=['privoxy'], is_external=False,
|
||||
enable=enable, disable=disable)
|
||||
|
||||
if service.is_enabled():
|
||||
add_shortcut()
|
||||
|
||||
|
||||
def setup(helper, old_version=None):
|
||||
@@ -74,6 +79,24 @@ def setup(helper, old_version=None):
|
||||
helper.call('pre', actions.superuser_run, 'privoxy', ['pre-install'])
|
||||
helper.install(managed_packages)
|
||||
helper.call('post', service.notify_enabled, None, True)
|
||||
helper.call('post', add_shortcut)
|
||||
|
||||
|
||||
def add_shortcut():
|
||||
frontpage.add_shortcut('privoxy', title, '?selected=privoxy',
|
||||
'glyphicon-cloud-upload', 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('privoxy')
|
||||
|
||||
|
||||
class PrivoxyServiceView(ServiceView):
|
||||
|
||||
Reference in new issue
Block a user