Merge "Support Restored status for backup"

This commit is contained in:
Zuul 2021-03-03 00:00:06 +00:00 committed by Gerrit Code Review
commit 77389fd1a9
3 changed files with 6 additions and 3 deletions

View File

@ -31,6 +31,7 @@ STATUS_CHOICES = (
("DELETE_FAILED", False), ("DELETE_FAILED", False),
("FAILED", False), ("FAILED", False),
("NEW", None), ("NEW", None),
("RESTORED", True),
("SAVING", None), ("SAVING", None),
) )
STATUS_DISPLAY_CHOICES = ( STATUS_DISPLAY_CHOICES = (
@ -44,6 +45,8 @@ STATUS_DISPLAY_CHOICES = (
u"Failed")), u"Failed")),
("NEW", pgettext_lazy("Current status of a Database Backup", ("NEW", pgettext_lazy("Current status of a Database Backup",
u"New")), u"New")),
("RESTORED", pgettext_lazy("Current status of a Database Backup",
u"Restored")),
("SAVING", pgettext_lazy("Current status of a Database Backup", ("SAVING", pgettext_lazy("Current status of a Database Backup",
u"Saving")), u"Saving")),
) )
@ -65,7 +68,7 @@ class RestoreLink(tables.LinkAction):
icon = "cloud-upload" icon = "cloud-upload"
def allowed(self, request, backup=None): def allowed(self, request, backup=None):
return backup.status == 'COMPLETED' return backup.status in ['COMPLETED', 'RESTORED']
def get_link_url(self, datum): def get_link_url(self, datum):
url = reverse(self.url) url = reverse(self.url)

View File

@ -87,7 +87,7 @@ class SetBackupDetails(workflows.Step):
class CreateBackup(workflows.Workflow): class CreateBackup(workflows.Workflow):
slug = "create_backup" slug = "create_backup"
name = _("Backup Database") name = _("Backup Database")
finalize_button_name = _("Backup") finalize_button_name = _("Create Backup")
success_message = _('Scheduled backup "%(name)s".') success_message = _('Scheduled backup "%(name)s".')
failure_message = _('Unable to launch %(count)s named "%(name)s".') failure_message = _('Unable to launch %(count)s named "%(name)s".')
success_url = "horizon:project:database_backups:index" success_url = "horizon:project:database_backups:index"

View File

@ -450,7 +450,7 @@ class AdvancedAction(workflows.Action):
for b in backups: for b in backups:
if self.backup_id and b.id != self.backup_id: if self.backup_id and b.id != self.backup_id:
continue continue
if b.status == 'COMPLETED': if b.status in ['COMPLETED', 'RESTORED']:
choices.append((b.id, b.name)) choices.append((b.id, b.name))
except Exception: except Exception:
choices = [] choices = []