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),
("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)

View File

@ -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"

View File

@ -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 = []