Merge "Show instance resize and rebuild actions in red"

This commit is contained in:
Jenkins 2017-08-04 11:09:23 +00:00 committed by Gerrit Code Review
commit d5900c33c2
3 changed files with 7 additions and 2 deletions

View File

@ -32,7 +32,11 @@
</button> </button>
{% else %} {% else %}
<a {{ action.attr_string_nc|safe }} <a {{ action.attr_string_nc|safe }}
class="btn data-table-action {% if is_single %}btn-default {% endif %}{% if is_small %}btn-sm {% endif %}{{ action.get_final_css|safe }}" class="btn data-table-action
{% if is_single %}btn-default{% endif %}
{% if is_small %}btn-sm{% endif %}
{% if action.action_type == "danger" %}btn-danger{% endif %}
{{ action.get_final_css|safe }}"
{% if is_table_action %} {% if is_table_action %}
href="{{ action.get_link_url }}" href="{{ action.get_link_url }}"
title="{{ action.verbose_name }}"> title="{{ action.verbose_name }}">

View File

@ -80,7 +80,6 @@ class LiveMigrateInstance(policy.PolicyTargetMixin,
classes = ("ajax-modal", "btn-migrate") classes = ("ajax-modal", "btn-migrate")
policy_rules = ( policy_rules = (
("compute", "os_compute_api:os-migrate-server:migrate_live"),) ("compute", "os_compute_api:os-migrate-server:migrate_live"),)
action_type = "danger"
def allowed(self, request, instance): def allowed(self, request, instance):
return ((instance.status in project_tables.ACTIVE_STATES) return ((instance.status in project_tables.ACTIVE_STATES)

View File

@ -536,6 +536,7 @@ class ResizeLink(policy.PolicyTargetMixin, tables.LinkAction):
url = "horizon:project:instances:resize" url = "horizon:project:instances:resize"
classes = ("ajax-modal", "btn-resize") classes = ("ajax-modal", "btn-resize")
policy_rules = (("compute", "os_compute_api:servers:resize"),) policy_rules = (("compute", "os_compute_api:servers:resize"),)
action_type = "danger"
def get_link_url(self, project): def get_link_url(self, project):
return self._get_link_url(project, 'flavor_choice') return self._get_link_url(project, 'flavor_choice')
@ -586,6 +587,7 @@ class RebuildInstance(policy.PolicyTargetMixin, tables.LinkAction):
classes = ("btn-rebuild", "ajax-modal") classes = ("btn-rebuild", "ajax-modal")
url = "horizon:project:instances:rebuild" url = "horizon:project:instances:rebuild"
policy_rules = (("compute", "os_compute_api:servers:rebuild"),) policy_rules = (("compute", "os_compute_api:servers:rebuild"),)
action_type = "danger"
def allowed(self, request, instance): def allowed(self, request, instance):
return ((instance.status in ACTIVE_STATES return ((instance.status in ACTIVE_STATES