mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
app: Add backup and restore menu items to toolbar menu
Closes: #2316. Tests: - Go to to power app. There is no menu. - Go to firewall app. There is a menu item but no backup and restore items present. - Go to bepasty app. There are backup and restore menu items in menu. Clicking backup items takes us to create backup page with only Bepasty app selected. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> [jvalleroy: Fix CSS classes for new menu items] Signed-off-by: James Valleroy <jvalleroy@mailbox.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
8f2520b327
commit
f1060fbf6b
@ -21,7 +21,7 @@
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
{% if has_diagnostics or show_uninstall %}
|
||||
{% if has_diagnostics or show_uninstall or has_backup_restore %}
|
||||
<!-- Single button -->
|
||||
<div class="btn-group button-secondary">
|
||||
<button type="button" class="btn btn-default dropdown-toggle"
|
||||
@ -33,6 +33,18 @@
|
||||
{% if has_diagnostics %}
|
||||
{% include "diagnostics_button.html" with app_id=app_id enabled=is_enabled %}
|
||||
{% endif %}
|
||||
{% if has_backup_restore %}
|
||||
<a class="dropdown-item backup-item"
|
||||
href="{% url 'backups:create' app_id=app_id %}"
|
||||
title="{% trans "Backup" %}">
|
||||
{% trans "Backup" %}
|
||||
</a>
|
||||
<a class="dropdown-item restore-item"
|
||||
href="{% url 'backups:index' %}"
|
||||
title="{% trans "Restore" %}">
|
||||
{% trans "Restore" %}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if show_uninstall %}
|
||||
<a class="dropdown-item uninstall-item"
|
||||
href="{% url 'uninstall' app_id=app_id %}"
|
||||
|
||||
@ -272,6 +272,12 @@ class AppView(FormView):
|
||||
from plinth.modules.firewall.components import Firewall
|
||||
context['firewall'] = self.app.get_components_of_type(Firewall)
|
||||
|
||||
from plinth.modules.backups.components import BackupRestore
|
||||
context['has_backup_restore'] = any([
|
||||
component.has_data
|
||||
for component in self.app.get_components_of_type(BackupRestore)
|
||||
])
|
||||
|
||||
return context
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user