From 66ff1a5f783293298843b2ab0cfee002df504000 Mon Sep 17 00:00:00 2001 From: Ana Krivokapic Date: Fri, 10 Apr 2015 14:51:33 +0200 Subject: Only show charts for provisioned nodes Only attempt to access metering data when there nodes which are either provisioned or provisioning. Also, do not fail when trying to access flavor which has no associated role. Change-Id: I2b3608702742524db36182f3bada106c04442405 --- tuskar_ui/infrastructure/flavors/tests.py | 4 ++-- tuskar_ui/infrastructure/flavors/views.py | 3 ++- .../infrastructure/templates/infrastructure/nodes/_overview.html | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tuskar_ui/infrastructure/flavors/tests.py b/tuskar_ui/infrastructure/flavors/tests.py index 4b7d5d12..470cb4f9 100644 --- a/tuskar_ui/infrastructure/flavors/tests.py +++ b/tuskar_ui/infrastructure/flavors/tests.py @@ -195,7 +195,7 @@ class FlavorsTest(test.BaseAdminViewTests): self.assertEqual(get_mock.call_count, 1) self.assertEqual(plan_mock.call_count, 2) self.assertEqual(roles_mock.call_count, 1) - self.assertEqual(role_flavor_mock.call_count, 4) + self.assertEqual(role_flavor_mock.call_count, 8) self.assertTemplateUsed(res, 'infrastructure/flavors/details.html') def test_details(self): @@ -224,7 +224,7 @@ class FlavorsTest(test.BaseAdminViewTests): self.assertEqual(flavor_mock.call_count, 1) self.assertEqual(plan_mock.call_count, 2) self.assertEqual(roles_mock.call_count, 1) - self.assertEqual(role_flavor_mock.call_count, 4) + self.assertEqual(role_flavor_mock.call_count, 8) self.assertEqual(stack_mock.call_count, 1) self.assertEqual(count_mock.call_count, 4) self.assertTemplateUsed(res, 'infrastructure/flavors/details.html') diff --git a/tuskar_ui/infrastructure/flavors/views.py b/tuskar_ui/infrastructure/flavors/views.py index b66d4aca..09c36ac7 100644 --- a/tuskar_ui/infrastructure/flavors/views.py +++ b/tuskar_ui/infrastructure/flavors/views.py @@ -99,4 +99,5 @@ class DetailView(horizon.tables.DataTableView): plan = api.tuskar.Plan.get_the_plan(self.request) return [role for role in api.tuskar.Role.list(self.request) - if role.flavor(plan).id == flavor_id] + if role.flavor(plan) + and role.flavor(plan).id == flavor_id] diff --git a/tuskar_ui/infrastructure/templates/infrastructure/nodes/_overview.html b/tuskar_ui/infrastructure/templates/infrastructure/nodes/_overview.html index 377980e2..373084af 100644 --- a/tuskar_ui/infrastructure/templates/infrastructure/nodes/_overview.html +++ b/tuskar_ui/infrastructure/templates/infrastructure/nodes/_overview.html @@ -88,11 +88,15 @@
+ {% if nodes_provisioned_count or nodes_provisioning_count %} {% url 'horizon:infrastructure:nodes:nodes_performance' as node_perf_url %} {% include "infrastructure/_performance_chart_box.html" with meter_conf=meter_conf node_perf_url=node_perf_url col_size=2 %} + {% endif %}
+{% if nodes_provisioned_count or nodes_provisioning_count %} {% include "infrastructure/_top_5_box.html" %} +{% endif %} {% if nodes_on_discovery_count or nodes_discovered_count or nodes_discovery_failed_count %}

{% trans "Nodes Discovery" %}


-- cgit v1.2.1