backups: Use AppView for the main app page

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2022-08-19 15:40:33 -07:00 committed by James Valleroy
parent d18e92af80
commit 2eca38299f
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
2 changed files with 7 additions and 6 deletions

View File

@ -5,14 +5,14 @@ URLs for the backups module.
from django.urls import re_path
from .views import (AddRemoteRepositoryView, AddRepositoryView,
from .views import (AddRemoteRepositoryView, AddRepositoryView, BackupsView,
CreateArchiveView, DeleteArchiveView, DownloadArchiveView,
IndexView, RemoveRepositoryView, RestoreArchiveView,
RemoveRepositoryView, RestoreArchiveView,
RestoreFromUploadView, ScheduleView, UploadArchiveView,
VerifySshHostkeyView, mount_repository, umount_repository)
urlpatterns = [
re_path(r'^sys/backups/$', IndexView.as_view(), name='index'),
re_path(r'^sys/backups/$', BackupsView.as_view(), name='index'),
re_path(r'^sys/backups/(?P<uuid>[^/]+)/schedule/$', ScheduleView.as_view(),
name='schedule'),
re_path(r'^sys/backups/create/$', CreateArchiveView.as_view(),

View File

@ -20,9 +20,9 @@ from django.utils.translation import gettext as _
from django.utils.translation import gettext_lazy
from django.views.generic import FormView, TemplateView, View
from plinth import app as app_module
from plinth.errors import PlinthError
from plinth.modules import backups, storage
from plinth.views import AppView
from . import (SESSION_PATH_VARIABLE, api, forms, get_known_hosts_path,
is_ssh_hostkey_verified)
@ -34,14 +34,15 @@ logger = logging.getLogger(__name__)
@method_decorator(delete_tmp_backup_file, name='dispatch')
class IndexView(TemplateView):
class BackupsView(AppView):
"""View to show list of archives."""
app_id = 'backups'
template_name = 'backups.html'
def get_context_data(self, **kwargs):
"""Return additional context for rendering the template."""
context = super().get_context_data(**kwargs)
context['app_info'] = app_module.App.get('backups').info
context['repositories'] = [
repository.get_view_content() for repository in get_repositories()
]