mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-03-11 09:04:54 +00:00
snapshot: Enable Delete All only with non-default snapshots
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
fe17a8e541
commit
074ab4a736
@ -40,11 +40,11 @@
|
||||
<div class="col-xs-6 text-right">
|
||||
<a title="{% trans 'Delete all the snapshots' %}"
|
||||
role="button" class="btn btn-danger"
|
||||
{% if snapshots|length == 1 %}
|
||||
disabled="disabled"
|
||||
{% else %}
|
||||
href="{% url 'snapshot:delete-all' %}"
|
||||
{% endif %}>
|
||||
{% if not has_deletable_snapshots %}
|
||||
disabled="disabled"
|
||||
{% else %}
|
||||
href="{% url 'snapshot:delete-all' %}"
|
||||
{% endif %}>
|
||||
{% trans 'Delete All' %}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@ -52,11 +52,15 @@ def index(request):
|
||||
|
||||
output = actions.superuser_run('snapshot', ['list'])
|
||||
snapshots = json.loads(output)
|
||||
has_deletable_snapshots = any(
|
||||
[snapshot for snapshot in snapshots[1:]
|
||||
if not snapshot['is_default']])
|
||||
|
||||
return TemplateResponse(request, 'snapshot.html', {
|
||||
'title': snapshot_module.name,
|
||||
'description': snapshot_module.description,
|
||||
'snapshots': snapshots,
|
||||
'has_deletable_snapshots': has_deletable_snapshots,
|
||||
'form': form
|
||||
})
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user