Changed the message level for deleting some resources to info
Added functionality to the handle function in the BatchAction class in action.py and allowed the easy changing between the alert types and made deleting images, instances, and volumes give an info alert rather than a success message and altered the testing parameters Change-Id: I93251d6d12cf89a331b5c051bf4fe10a6e470f51 Closes-Bug: #1291681
This commit is contained in:
parent
07070c437d
commit
2a3b04ce6c
horizon/tables
openstack_dashboard/dashboards/project
@ -657,6 +657,7 @@ class BatchAction(Action):
|
||||
"""
|
||||
|
||||
help_text = _("This action cannot be undone.")
|
||||
default_message_level = "success"
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(BatchAction, self).__init__(**kwargs)
|
||||
@ -798,8 +799,7 @@ class BatchAction(Action):
|
||||
'Action %(action)s Failed for %(reason)s', {
|
||||
'action': action_description, 'reason': ex})
|
||||
|
||||
# Begin with success message class, downgrade to info if problems.
|
||||
success_message_level = messages.success
|
||||
success_message_level = getattr(messages, self.default_message_level)
|
||||
if action_not_allowed:
|
||||
msg = _('You are not allowed to %(action)s: %(objs)s')
|
||||
params = {"action":
|
||||
|
@ -85,6 +85,7 @@ class DeleteImage(tables.DeleteAction):
|
||||
# NOTE: The bp/add-batchactions-help-text
|
||||
# will add appropriate help text to some batch/delete actions.
|
||||
help_text = _("Deleted images are not recoverable.")
|
||||
default_message_level = "info"
|
||||
|
||||
@staticmethod
|
||||
def action_present(count):
|
||||
|
@ -83,6 +83,7 @@ def is_deleting(instance):
|
||||
class DeleteInstance(policy.PolicyTargetMixin, tables.DeleteAction):
|
||||
policy_rules = (("compute", "os_compute_api:servers:delete"),)
|
||||
help_text = _("Deleted instances are not recoverable.")
|
||||
default_message_level = "info"
|
||||
|
||||
@staticmethod
|
||||
def action_present(count):
|
||||
|
@ -4958,7 +4958,7 @@ class InstanceTests2(InstanceTestBase, InstanceTableTestMixin):
|
||||
res = self.client.post(next_page_url, formData)
|
||||
|
||||
self.assertRedirectsNoFollow(res, next_page_url)
|
||||
self.assertMessageCount(success=1)
|
||||
self.assertMessageCount(info=1)
|
||||
|
||||
search_opts = {'marker': servers[page_size - 1].id, 'paginate': True}
|
||||
self.mock_server_list.assert_called_once_with(
|
||||
|
@ -92,6 +92,7 @@ class LaunchVolumeNG(LaunchVolume):
|
||||
class DeleteVolume(VolumePolicyTargetMixin, tables.DeleteAction):
|
||||
help_text = _("Deleted volumes are not recoverable. "
|
||||
"All data stored in the volume will be removed.")
|
||||
default_message_level = "info"
|
||||
|
||||
@staticmethod
|
||||
def action_present(count):
|
||||
|
Loading…
x
Reference in New Issue
Block a user