From abdae9c3286a5b0c3c78cbd728f4e7a240bae5c8 Mon Sep 17 00:00:00 2001 From: Imre Farkas Date: Mon, 29 Jul 2013 13:55:39 +0200 Subject: Disable charts on resource class detail page without a provisioned rack Change-Id: I5a38474ac6cd8e8198b8f9c7ce6f32079d1ff29b --- openstack_dashboard/api/tuskar.py | 4 +++ .../resource_classes/_detail_overview.html | 34 ++++++++++++++++++++-- .../resource_classes/detail.html | 7 +++++ 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/openstack_dashboard/api/tuskar.py b/openstack_dashboard/api/tuskar.py index 8f0e6e89..db2ae0e1 100644 --- a/openstack_dashboard/api/tuskar.py +++ b/openstack_dashboard/api/tuskar.py @@ -708,6 +708,10 @@ class ResourceClass(StringIdAPIResourceWrapper): return [rack for rack in self.list_racks if (rack.alerts + rack.aggregated_alerts)] + @property + def has_provisioned_rack(self): + return any([rack.is_provisioned for rack in self.list_racks]) + class FlavorTemplate(StringIdAPIResourceWrapper): """Wrapper for the Flavor object returned by the diff --git a/openstack_dashboard/dashboards/infrastructure/resource_management/templates/resource_management/resource_classes/_detail_overview.html b/openstack_dashboard/dashboards/infrastructure/resource_management/templates/resource_management/resource_classes/_detail_overview.html index 3e1b0e8d..8916e47e 100644 --- a/openstack_dashboard/dashboards/infrastructure/resource_management/templates/resource_management/resource_classes/_detail_overview.html +++ b/openstack_dashboard/dashboards/infrastructure/resource_management/templates/resource_management/resource_classes/_detail_overview.html @@ -36,6 +36,7 @@ {% for capacity in resource_class.capacities %} + {% if resource_class.has_provisioned_rack %} + {% else %} + + + {% endif %} {% endfor %}
{{ capacity.name }}: +
+
+
@@ -62,12 +72,17 @@

{% trans "Capacity Usage" %}


+ {% if resource_class.has_provisioned_rack %}
+ {% else %} +

{% trans "No data available yet." %}

+ {% endif %}

{% trans "Active Alerts" %}


+ {% if resource_class.has_provisioned_rack %} + {% else %} +

{% trans "No data available yet." %}

+ {% endif %}
@@ -83,6 +101,7 @@

{% trans "Summary of Instances and Usage" %}


+ {% if resource_class.has_provisioned_rack %}
-
{{ resource_class.total_instances }} instances - {{resource_class.remaining_capacity}}% capacity remaining
+
+ {{ resource_class.total_instances }} instances + {{resource_class.remaining_capacity}}% capacity remaining +
- + {% else %} +

{% trans "No data available yet." %}

+ {% endif %}
@@ -164,6 +187,7 @@

Rack health

+ {% if resource_class.has_provisioned_rack %}
+ {% else %} +
+

{% trans "No data available yet." %}

+ {% endif %}
diff --git a/openstack_dashboard/dashboards/infrastructure/resource_management/templates/resource_management/resource_classes/detail.html b/openstack_dashboard/dashboards/infrastructure/resource_management/templates/resource_management/resource_classes/detail.html index ea39d5df..0c6ecaef 100644 --- a/openstack_dashboard/dashboards/infrastructure/resource_management/templates/resource_management/resource_classes/detail.html +++ b/openstack_dashboard/dashboards/infrastructure/resource_management/templates/resource_management/resource_classes/detail.html @@ -43,12 +43,19 @@ {% trans "Usage" %}: + {% if resource_class.has_provisioned_rack %}
+ {% else %} +
+
+ {% endif %} -- cgit v1.2.1