From 25347e64fcb752c1105ede076f26e66da7582149 Mon Sep 17 00:00:00 2001 From: Lingxian Kong Date: Wed, 3 Mar 2021 11:49:23 +1300 Subject: [PATCH] Support Restored status for backup Change-Id: I26e3ca1746d7898334699192ad0581744c613248 --- trove_dashboard/content/database_backups/tables.py | 5 ++++- .../content/database_backups/workflows/create_backup.py | 2 +- .../content/databases/workflows/create_instance.py | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/trove_dashboard/content/database_backups/tables.py b/trove_dashboard/content/database_backups/tables.py index f77df2d..8ccf0ed 100644 --- a/trove_dashboard/content/database_backups/tables.py +++ b/trove_dashboard/content/database_backups/tables.py @@ -31,6 +31,7 @@ STATUS_CHOICES = ( ("DELETE_FAILED", False), ("FAILED", False), ("NEW", None), + ("RESTORED", True), ("SAVING", None), ) STATUS_DISPLAY_CHOICES = ( @@ -44,6 +45,8 @@ STATUS_DISPLAY_CHOICES = ( u"Failed")), ("NEW", pgettext_lazy("Current status of a Database Backup", u"New")), + ("RESTORED", pgettext_lazy("Current status of a Database Backup", + u"Restored")), ("SAVING", pgettext_lazy("Current status of a Database Backup", u"Saving")), ) @@ -65,7 +68,7 @@ class RestoreLink(tables.LinkAction): icon = "cloud-upload" def allowed(self, request, backup=None): - return backup.status == 'COMPLETED' + return backup.status in ['COMPLETED', 'RESTORED'] def get_link_url(self, datum): url = reverse(self.url) diff --git a/trove_dashboard/content/database_backups/workflows/create_backup.py b/trove_dashboard/content/database_backups/workflows/create_backup.py index 952bef0..d089a36 100644 --- a/trove_dashboard/content/database_backups/workflows/create_backup.py +++ b/trove_dashboard/content/database_backups/workflows/create_backup.py @@ -87,7 +87,7 @@ class SetBackupDetails(workflows.Step): class CreateBackup(workflows.Workflow): slug = "create_backup" name = _("Backup Database") - finalize_button_name = _("Backup") + finalize_button_name = _("Create Backup") success_message = _('Scheduled backup "%(name)s".') failure_message = _('Unable to launch %(count)s named "%(name)s".') success_url = "horizon:project:database_backups:index" diff --git a/trove_dashboard/content/databases/workflows/create_instance.py b/trove_dashboard/content/databases/workflows/create_instance.py index f32ef13..c982916 100644 --- a/trove_dashboard/content/databases/workflows/create_instance.py +++ b/trove_dashboard/content/databases/workflows/create_instance.py @@ -450,7 +450,7 @@ class AdvancedAction(workflows.Action): for b in backups: if self.backup_id and b.id != self.backup_id: continue - if b.status == 'COMPLETED': + if b.status in ['COMPLETED', 'RESTORED']: choices.append((b.id, b.name)) except Exception: choices = []