From 6934660945e589b595c3a53179064488d25c4079 Mon Sep 17 00:00:00 2001 From: Tatiana Ovchinnikova Date: Tue, 27 Jan 2015 16:13:32 +0300 Subject: [PATCH] Stack resources table improvement In spite of the fact that status of stack resource is "Create complete", the row color remains yellow instead of grey. This patch set keeps the column for detailed states and adds a new hidden column for correct states displaying. Closes-Bug: #1385244 Change-Id: I2a9e5a6f456378dcd1f96d96f69fdba1527e4f25 --- .../dashboards/project/stacks/tables.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/openstack_dashboard/dashboards/project/stacks/tables.py b/openstack_dashboard/dashboards/project/stacks/tables.py index 4c32955394..200fca3a17 100644 --- a/openstack_dashboard/dashboards/project/stacks/tables.py +++ b/openstack_dashboard/dashboards/project/stacks/tables.py @@ -336,9 +336,13 @@ class ResourcesUpdateRow(tables.Row): class ResourcesTable(tables.DataTable): + class StatusColumn(tables.Column): + def get_raw_data(self, datum): + return datum.resource_status.partition("_")[2] + STATUS_CHOICES = ( - ("Create Complete", True), - ("Create Failed", False), + ("Complete", True), + ("Failed", False), ) logical_resource = tables.Column('resource_name', @@ -355,13 +359,16 @@ class ResourcesTable(tables.DataTable): filters.timesince_or_never)) status = tables.Column("resource_status", filters=(title, filters.replace_underscores), - verbose_name=_("Status"), - status=True, - status_choices=STATUS_CHOICES) + verbose_name=_("Status")) statusreason = tables.Column("resource_status_reason", verbose_name=_("Status Reason"),) + status_hidden = StatusColumn("status", + hidden=True, + status=True, + status_choices=STATUS_CHOICES) + def __init__(self, request, data=None, needs_form_wrapper=None, **kwargs): super(ResourcesTable, self).__init__( @@ -374,5 +381,5 @@ class ResourcesTable(tables.DataTable): class Meta(object): name = "resources" verbose_name = _("Stack Resources") - status_columns = ["status", ] + status_columns = ["status_hidden", ] row_class = ResourcesUpdateRow