Remove Create Backup Action For Non-Active
the "create backup" action is incorrectly shown for a non-active database instance in the database instances table. now, only if the instance is active, will the action/button appear. in addition, non-active instances are now excluded from the dropdown in the create-backup workflow. Change-Id: Id9fdeab84ad91b96ba1a9f07ee6d1af87b6320f7 Closes-Bug: #1268260
This commit is contained in:
parent
f7d00b5960
commit
f7ee4e0c01
|
@ -23,6 +23,9 @@ from horizon import forms
|
|||
from horizon import workflows
|
||||
|
||||
from openstack_dashboard import api
|
||||
from openstack_dashboard.dashboards.project.databases \
|
||||
import tables as project_tables
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -48,7 +51,8 @@ class BackupDetailsAction(workflows.Action):
|
|||
instances = []
|
||||
msg = _("Unable to list database instance to backup.")
|
||||
exceptions.handle(request, msg)
|
||||
return [(i.id, i.name) for i in instances]
|
||||
return [(i.id, i.name) for i in instances
|
||||
if i.status in project_tables.ACTIVE_STATES]
|
||||
|
||||
|
||||
class SetBackupDetails(workflows.Step):
|
||||
|
|
|
@ -105,7 +105,8 @@ class CreateBackup(tables.LinkAction):
|
|||
classes = ("ajax-modal", "btn-camera")
|
||||
|
||||
def allowed(self, request, instance=None):
|
||||
return request.user.has_perm('openstack.services.object-store')
|
||||
return (instance.status in ACTIVE_STATES and
|
||||
request.user.has_perm('openstack.services.object-store'))
|
||||
|
||||
def get_link_url(self, datam):
|
||||
url = urlresolvers.reverse(self.url)
|
||||
|
|
Loading…
Reference in New Issue