From 9a975ebaf5631ba2036cb4d9607d7771d909d518 Mon Sep 17 00:00:00 2001 From: Ying Zuo Date: Wed, 12 Jul 2017 17:47:27 -0700 Subject: [PATCH] Show instance resize and rebuild actions in red Updated the template used for LinkAction to add the css class for destructive action if action_type is set to "danger". Removed the action_type for live migration action because it is not a destructive action. Change-Id: Ib957597aa065df4c8a65303b1dc95a5c762ae3d3 Closes-bug: #1704014 --- horizon/templates/horizon/common/_data_table_action.html | 6 +++++- openstack_dashboard/dashboards/admin/instances/tables.py | 1 - openstack_dashboard/dashboards/project/instances/tables.py | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/horizon/templates/horizon/common/_data_table_action.html b/horizon/templates/horizon/common/_data_table_action.html index c855f1895a..83d3763fe5 100644 --- a/horizon/templates/horizon/common/_data_table_action.html +++ b/horizon/templates/horizon/common/_data_table_action.html @@ -32,7 +32,11 @@ {% else %} diff --git a/openstack_dashboard/dashboards/admin/instances/tables.py b/openstack_dashboard/dashboards/admin/instances/tables.py index 8dbf50f06d..ecdcba973b 100644 --- a/openstack_dashboard/dashboards/admin/instances/tables.py +++ b/openstack_dashboard/dashboards/admin/instances/tables.py @@ -80,7 +80,6 @@ class LiveMigrateInstance(policy.PolicyTargetMixin, classes = ("ajax-modal", "btn-migrate") policy_rules = ( ("compute", "os_compute_api:os-migrate-server:migrate_live"),) - action_type = "danger" def allowed(self, request, instance): return ((instance.status in project_tables.ACTIVE_STATES) diff --git a/openstack_dashboard/dashboards/project/instances/tables.py b/openstack_dashboard/dashboards/project/instances/tables.py index f2bf1eebb8..01fe50a43a 100644 --- a/openstack_dashboard/dashboards/project/instances/tables.py +++ b/openstack_dashboard/dashboards/project/instances/tables.py @@ -536,6 +536,7 @@ class ResizeLink(policy.PolicyTargetMixin, tables.LinkAction): url = "horizon:project:instances:resize" classes = ("ajax-modal", "btn-resize") policy_rules = (("compute", "os_compute_api:servers:resize"),) + action_type = "danger" def get_link_url(self, project): return self._get_link_url(project, 'flavor_choice') @@ -586,6 +587,7 @@ class RebuildInstance(policy.PolicyTargetMixin, tables.LinkAction): classes = ("btn-rebuild", "ajax-modal") url = "horizon:project:instances:rebuild" policy_rules = (("compute", "os_compute_api:servers:rebuild"),) + action_type = "danger" def allowed(self, request, instance): return ((instance.status in ACTIVE_STATES