apps: Separate enabled and disabled apps

- Add 'secondary' flag to menu items.

- Mark apps as 'secondary' when disabled.

- Extend TemplateView for apps index.

- Add card-container for disabled apps.

Closes #1309

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
James Valleroy authored and Sunil Mohan Adapa committed 2019-05-07 16:57:55 -07:00
1 parent fe16bf4d26
commit 893bd2b4d6
27 files changed
+295 -103

No files matched your search

+10 -2
View File
@@ -48,8 +48,8 @@ description = [
_('Your {box_name} can run a Shadowsocks client, that can connect to '
'a Shadowsocks server. It will also run a SOCKS5 proxy. Local '
'devices can connect to this proxy, and their data will be '
'encrypted and proxied through the Shadowsocks server.'), box_name=_(
cfg.box_name)),
'encrypted and proxied through the Shadowsocks server.'),
box_name=_(cfg.box_name)),
_('To use Shadowsocks after setup, set the SOCKS5 proxy URL in your '
'device, browser or application to http://freedombox_address:1080/')
]
@@ -73,6 +73,7 @@ def init():
if service.is_enabled():
add_shortcut()
menu.promote_item('shadowsocks:index')
def setup(helper, old_version=None):
@@ -86,6 +87,9 @@ def setup(helper, old_version=None):
], is_external=False, is_enabled=is_enabled, is_running=is_running,
enable=enable, disable=disable)
menu = main_menu.get('apps')
helper.call('post', menu.promote_item, 'shadowsocks:index')
def add_shortcut():
"""Helper method to add a shortcut to the frontpage."""
@@ -109,12 +113,16 @@ def enable():
"""Enable service."""
actions.superuser_run('service', ['enable', managed_services[0]])
add_shortcut()
menu = main_menu.get('apps')
menu.promote_item('shadowsocks:index')
def disable():
"""Disable service."""
actions.superuser_run('service', ['disable', managed_services[0]])
frontpage.remove_shortcut('shadowsocks')
menu = main_menu.get('apps')
menu.demote_item('shadowsocks:index')
def diagnose():