summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAna Krivokapic <akrivoka@redhat.com>2015-04-10 14:51:33 +0200
committerAna Krivokapic <akrivoka@redhat.com>2015-04-10 14:54:25 +0200
commit66ff1a5f783293298843b2ab0cfee002df504000 (patch)
tree57603a3d1bc68358e0fe137103aa40b5eee3a89c
parent761e79dae0f575e70e9b2973053113a568c33998 (diff)
downloadtuskar-ui-66ff1a5f783293298843b2ab0cfee002df504000.tar.gz
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
-rw-r--r--tuskar_ui/infrastructure/flavors/tests.py4
-rw-r--r--tuskar_ui/infrastructure/flavors/views.py3
-rw-r--r--tuskar_ui/infrastructure/templates/infrastructure/nodes/_overview.html4
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 @@
</div>
</div>
<div>
+ {% 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 %}
</div>
</div>
+{% 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 %}
<h3>{% trans "Nodes Discovery" %}</h3>
<hr>