diff --git a/plinth/modules/snapshot/forms.py b/plinth/modules/snapshot/forms.py
index 39bdc7092..23ec8fc0e 100644
--- a/plinth/modules/snapshot/forms.py
+++ b/plinth/modules/snapshot/forms.py
@@ -29,25 +29,25 @@ class SnapshotForm(forms.Form):
'(hourly, daily, monthly and yearly).'))
hourly_limit = forms.IntegerField(
- label=_('Hourly Snapshots Limit'), min_value=0,
- help_text=('Snapper will only keep this number of hourly snapshots.'))
+ label=_('Hourly Snapshots Limit'), min_value=0, help_text=_(
+ 'Keep a maximum of this many hourly snapshots.'))
daily_limit = forms.IntegerField(
- label=_('Daily Snapshots Limit'), min_value=0,
- help_text=('Snapper will only keep this number of daily snapshots.'))
+ label=_('Daily Snapshots Limit'), min_value=0, help_text=_(
+ 'Keep a maximum of this many daily snapshots.'))
weekly_limit = forms.IntegerField(
- label=_('Weekly Snapshots Limit'), min_value=0,
- help_text=('Snapper will only keep this number of weekly snapshots.'))
+ label=_('Weekly Snapshots Limit'), min_value=0, help_text=_(
+ 'Keep a maximum of this many weekly snapshots.'))
monthly_limit = forms.IntegerField(
- label=_('Monthly Snapshots Limit'), min_value=0,
- help_text=('Snapper will only keep this number of monthly snapshots.'))
+ label=_('Monthly Snapshots Limit'), min_value=0, help_text=_(
+ 'Keep a maximum of this many monthly snapshots.'))
yearly_limit = forms.IntegerField(
- label=_('Yearly Snapshots Limit'), min_value=0,
- help_text=('Snapper will only keep this number of yearly snapshots. '
- 'The default is 0 (disabled).'))
+ label=_('Yearly Snapshots Limit'), min_value=0, help_text=_(
+ 'Keep a maximum of this many yearly snapshots. '
+ 'The default is 0 (disabled).'))
number_min_age = forms.IntegerField(
label=_('Delete Software Snapshots older than (days)'), min_value=0,
diff --git a/plinth/modules/snapshot/templates/snapshot.html b/plinth/modules/snapshot/templates/snapshot.html
index a68a04fac..ea43c8959 100644
--- a/plinth/modules/snapshot/templates/snapshot.html
+++ b/plinth/modules/snapshot/templates/snapshot.html
@@ -23,85 +23,12 @@
{% block configuration %}
-
{% endblock %}
diff --git a/plinth/modules/snapshot/templates/snapshot_manage.html b/plinth/modules/snapshot/templates/snapshot_manage.html
new file mode 100644
index 000000000..8df08307b
--- /dev/null
+++ b/plinth/modules/snapshot/templates/snapshot_manage.html
@@ -0,0 +1,103 @@
+{% extends "simple_service.html" %}
+{% comment %}
+#
+# This file is part of FreedomBox.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+{% endcomment %}
+
+{% load bootstrap %}
+{% load i18n %}
+
+{% block configuration %}
+
+
+
+
+
+
+
+
+
+ | {% trans "Number" %} |
+ {% trans "Date" %} |
+ {% trans "Description" %} |
+ {% trans "Rollback" %} |
+ {% trans "Delete" %} |
+
+
+ {% for snapshot in snapshots %}
+ {% if snapshot.description != "current" %}
+
+ |
+ {{ snapshot.number }}
+ {% if snapshot.is_default %}
+
+ {% trans "active" %}
+
+ {% endif %}
+ |
+ {{ snapshot.date }} |
+ {{ snapshot.description }} |
+
+
+
+
+ |
+
+ {% if not snapshot.is_default %}
+
+
+
+ {% endif %}
+ |
+
+ {% endif %}
+ {% endfor %}
+
+
+
+
+
+{% endblock %}
diff --git a/plinth/modules/snapshot/urls.py b/plinth/modules/snapshot/urls.py
index 0027f634e..5ac318b16 100644
--- a/plinth/modules/snapshot/urls.py
+++ b/plinth/modules/snapshot/urls.py
@@ -24,6 +24,7 @@ from . import views
urlpatterns = [
url(r'^sys/snapshot/$', views.index, name='index'),
+ url(r'^sys/snapshot/manage/$', views.manage, name='manage'),
url(r'^sys/snapshot/(?P\d+)/delete$', views.delete, name='delete'),
url(r'^sys/snapshot/all/delete$', views.delete_all, name='delete-all'),
url(r'^sys/snapshot/(?P\d+)/rollback$', views.rollback,
diff --git a/plinth/modules/snapshot/views.py b/plinth/modules/snapshot/views.py
index e2e147a36..1ae402799 100644
--- a/plinth/modules/snapshot/views.py
+++ b/plinth/modules/snapshot/views.py
@@ -23,26 +23,28 @@ import json
from django.contrib import messages
from django.shortcuts import redirect
from django.template.response import TemplateResponse
-from django.urls import reverse
-from django.utils.translation import ugettext as _
+from django.urls import reverse, reverse_lazy
from plinth import actions
from plinth.errors import ActionError
from plinth.modules import snapshot as snapshot_module
from plinth.utils import yes_or_no
+from django.utils.translation import ugettext as _, ugettext_lazy
from . import get_configuration
from .forms import SnapshotForm
+subsubmenu = [{'url': reverse_lazy('snapshot:index'),
+ 'text': ugettext_lazy('Configure')},
+ {'url': reverse_lazy('snapshot:manage'),
+ 'text': ugettext_lazy('Manage Snapshots')}]
+
def index(request):
"""Show snapshot list."""
status = get_configuration()
if request.method == 'POST':
form = SnapshotForm(request.POST)
- if 'create' in request.POST:
- actions.superuser_run('snapshot', ['create'])
- messages.success(request, _('Created snapshot.'))
if 'update' in request.POST and form.is_valid():
update_configuration(request, status, form.cleaned_data)
status = get_configuration()
@@ -50,18 +52,32 @@ def index(request):
else:
form = SnapshotForm(initial=status)
+ return TemplateResponse(
+ request, 'snapshot.html', {
+ 'title': snapshot_module.name,
+ 'description': snapshot_module.description,
+ 'subsubmenu': subsubmenu,
+ 'form': form
+ })
+
+
+def manage(request):
+ """Show snapshot list."""
+ if request.method == 'POST':
+ if 'create' in request.POST:
+ actions.superuser_run('snapshot', ['create'])
+ messages.success(request, _('Created snapshot.'))
+
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,
+ request, 'snapshot_manage.html', {
'snapshots': snapshots,
'has_deletable_snapshots': has_deletable_snapshots,
- 'form': form
+ 'subsubmenu': subsubmenu,
})
@@ -108,7 +124,7 @@ def delete(request, number):
messages.success(
request,
_('Deleted snapshot #{number}.').format(number=number))
- return redirect(reverse('snapshot:index'))
+ return redirect(reverse('snapshot:manage'))
output = actions.superuser_run('snapshot', ['list'])
snapshots = json.loads(output)
@@ -125,7 +141,7 @@ def delete_all(request):
if request.method == 'POST':
actions.superuser_run('snapshot', ['delete-all'])
messages.success(request, _('Deleted all snapshots.'))
- return redirect(reverse('snapshot:index'))
+ return redirect(reverse('snapshot:manage'))
output = actions.superuser_run('snapshot', ['list'])
snapshots = json.loads(output)