Add "Check Stack" action to Stacks table
This patch set adds "Check Stack" button to Stacks table to provide user with a possibility to check stack, like it is already implemented in CLI. Partially implements blueprint: heat-ui-improvement Change-Id: I0a2c6f62844a4120081e74689c4ca8d8cf35251d
This commit is contained in:
parent
fd92da01d8
commit
a57e913e6c
|
@ -126,6 +126,10 @@ def template_validate(request, **kwargs):
|
|||
return heatclient(request).stacks.validate(**kwargs)
|
||||
|
||||
|
||||
def action_check(request, stack_id):
|
||||
return heatclient(request).actions.check(stack_id)
|
||||
|
||||
|
||||
def resource_types_list(request):
|
||||
return heatclient(request).resource_types.list()
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
"cloudformation:DescribeStackResource": "",
|
||||
"cloudformation:DescribeStackResources": "rule:deny_stack_user",
|
||||
"cloudformation:ListStackResources": "rule:deny_stack_user",
|
||||
"cloudformation:CheckStack": "rule:deny_stack_user",
|
||||
|
||||
"cloudwatch:DeleteAlarms": "rule:deny_stack_user",
|
||||
"cloudwatch:DescribeAlarmHistory": "rule:deny_stack_user",
|
||||
|
|
|
@ -36,6 +36,31 @@ class LaunchStack(tables.LinkAction):
|
|||
policy_rules = (("orchestration", "cloudformation:CreateStack"),)
|
||||
|
||||
|
||||
class CheckStack(tables.BatchAction):
|
||||
name = "check"
|
||||
verbose_name = _("Check Stack")
|
||||
policy_rules = (("orchestration", "cloudformation:CheckStack"),)
|
||||
|
||||
@staticmethod
|
||||
def action_present(count):
|
||||
return ungettext_lazy(
|
||||
u"Check Stack",
|
||||
u"Check Stacks",
|
||||
count
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def action_past(count):
|
||||
return ungettext_lazy(
|
||||
u"Checked Stack",
|
||||
u"Checked Stacks",
|
||||
count
|
||||
)
|
||||
|
||||
def action(self, request, stack_id):
|
||||
api.heat.action_check(request, stack_id)
|
||||
|
||||
|
||||
class ChangeStackTemplate(tables.LinkAction):
|
||||
name = "edit"
|
||||
verbose_name = _("Change Stack Template")
|
||||
|
@ -127,9 +152,8 @@ class StacksTable(tables.DataTable):
|
|||
pagination_param = 'stack_marker'
|
||||
status_columns = ["status", ]
|
||||
row_class = StacksUpdateRow
|
||||
table_actions = (LaunchStack, DeleteStack,)
|
||||
row_actions = (DeleteStack,
|
||||
ChangeStackTemplate)
|
||||
table_actions = (LaunchStack, CheckStack, DeleteStack,)
|
||||
row_actions = (CheckStack, ChangeStackTemplate, DeleteStack,)
|
||||
|
||||
|
||||
def get_resource_url(obj):
|
||||
|
|
|
@ -671,6 +671,14 @@ class StackTests(test.TestCase):
|
|||
self.assertFormErrors(res, 1)
|
||||
self.assertFormError(res, "form", 'stack_name', error)
|
||||
|
||||
def test_check_stack(self):
|
||||
stack = self.stacks.first()
|
||||
form_data = {"action": "stacks__check__%s" % stack.id}
|
||||
res = self.client.post(INDEX_URL, form_data)
|
||||
|
||||
self.assertNoFormErrors(res)
|
||||
self.assertRedirectsNoFollow(res, INDEX_URL)
|
||||
|
||||
|
||||
class TemplateFormTests(test.TestCase):
|
||||
|
||||
|
|
Loading…
Reference in New Issue