From 8cdd8b24337a2e4843a51d6968a4cf6dab822136 Mon Sep 17 00:00:00 2001 From: Imre Farkas Date: Thu, 25 Jul 2013 16:01:37 +0200 Subject: Add charts to provisioned node details page Change-Id: If138e9e7896c358de7b788f6f3cdeff2346c7414 --- openstack_dashboard/api/tuskar.py | 34 ++++++++- .../nodes/_detail_overview.html | 83 ++++++++++++++++++++-- .../resource_management/nodes/detail.html | 7 ++ 3 files changed, 118 insertions(+), 6 deletions(-) diff --git a/openstack_dashboard/api/tuskar.py b/openstack_dashboard/api/tuskar.py index 08bd304c..2ebdeb45 100644 --- a/openstack_dashboard/api/tuskar.py +++ b/openstack_dashboard/api/tuskar.py @@ -156,6 +156,27 @@ class Node(StringIdAPIResourceWrapper): usage=usage, rack=rack) node.save() + @property + def list_flavors(self): + if not hasattr(self, '_flavors'): + # FIXME: just a mock of used instances, add real values + used_instances = 0 + + resource_class = self.rack.resource_class + added_flavors = tuskarclient(self.request).flavors\ + .list(resource_class.id) + self._flavors = [] + for f in added_flavors: + flavor_obj = Flavor(f) + #flavor_obj.max_vms = f.max_vms + + # FIXME just a mock of used instances, add real values + used_instances += 5 + flavor_obj.used_instances = used_instances + self._flavors.append(flavor_obj) + + return self._flavors + @property def capacities(self): if not hasattr(self, '_capacities'): @@ -251,8 +272,19 @@ class Node(StringIdAPIResourceWrapper): return self._vm_capacity @property + # FIXME: just mock implementation, add proper one + def running_instances(self): + return 4 + + @property + # FIXME: just mock implementation, add proper one + def remaining_capacity(self): + return 100 - self.running_instances + + @property + # FIXME: just mock implementation, add proper one def is_provisioned(self): - return False + return self.rack is not None @property def alerts(self): diff --git a/openstack_dashboard/dashboards/infrastructure/resource_management/templates/resource_management/nodes/_detail_overview.html b/openstack_dashboard/dashboards/infrastructure/resource_management/templates/resource_management/nodes/_detail_overview.html index e6823ed0..032e4477 100644 --- a/openstack_dashboard/dashboards/infrastructure/resource_management/templates/resource_management/nodes/_detail_overview.html +++ b/openstack_dashboard/dashboards/infrastructure/resource_management/templates/resource_management/nodes/_detail_overview.html @@ -1,5 +1,6 @@ {% load i18n sizeformat %} {% load url from future %} +{% load chart_helpers %}
@@ -53,7 +54,7 @@
- {{ node.cpu.usage }}/{{ node.cpu.value }} {{ node.cpu.unit }} + {{ node.cpu.usage }}/{{ node.cpu.value }} {{ node.cpu.unit }} {% else %} @@ -78,7 +79,7 @@
- {{ node.ram.usage }}/{{ node.ram.value }} {{ node.ram.unit }} + {{ node.ram.usage }}/{{ node.ram.value }} {{ node.ram.unit }} {% else %} @@ -103,7 +104,7 @@ - {{ node.storage.usage }}/{{ node.storage.value }} {{ node.storage.unit }} + {{ node.storage.usage }}/{{ node.storage.value }} {{ node.storage.unit }} {% else %} @@ -128,7 +129,7 @@ - {{ node.network.usage }}/{{ node.network.value }} {{ node.network.unit }} + {{ node.network.usage }}/{{ node.network.value }} {{ node.network.unit }} {% else %} @@ -149,6 +150,56 @@

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


{% if node.is_provisioned %} +
+ {{ node.running_instances }} instances + {{ node.remaining_capacity }}% capacity remaining +
+
+
+ + + + {% for flavor in node.list_flavors %} + + {% endfor %} + + + {% for flavor in node.list_flavors %} + + {% endfor %} + + + {% for flavor in resource_class.list_flavors %} + + {% endfor %} + + + {% for flavor in resource_class.list_flavors %} + + {% endfor %} + +
+ {{ flavor.name }} +
+
+
+
{{ flavor.used_instances }} inst.
{% else %}

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

@@ -175,7 +226,29 @@

{% trans "Top Communicating Nodes" %}


{% if node.is_provisioned %} - +
+
+
The most contacting
+
+
+
+
-->BG-IMG-->
+
+
The most contacted
+
+
+
+
{% else %}

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

{% endif %} diff --git a/openstack_dashboard/dashboards/infrastructure/resource_management/templates/resource_management/nodes/detail.html b/openstack_dashboard/dashboards/infrastructure/resource_management/templates/resource_management/nodes/detail.html index 42f2f73d..729727e2 100644 --- a/openstack_dashboard/dashboards/infrastructure/resource_management/templates/resource_management/nodes/detail.html +++ b/openstack_dashboard/dashboards/infrastructure/resource_management/templates/resource_management/nodes/detail.html @@ -28,6 +28,7 @@ {% trans "Usage" %}: + {% if node.is_provisioned %}
+ {% else %} +
+
+ {% endif %} -- cgit v1.2.1