Add role distribution pie chart

Also fix the nodes pie charts to conform to the changes recently
introduced to Horizon.

Change-Id: I37f36821f69a9c65ad95dcf30c9472a9a3f395d7
This commit is contained in:
Ana Krivokapic 2014-02-28 14:16:39 +01:00
parent d2d80fa9ef
commit 393205d1bb
4 changed files with 5 additions and 31 deletions

View File

@ -75,7 +75,7 @@
<div class="span4">
<div class="widget">
<h2>{% trans 'Provisioning Status' %}</h2>
<div class="d3_pie_chart pull-left" data-used="{% widthratio deployed_nodes|length total_nodes|length 100 %}"></div>
<div class="d3_pie_chart_usage pull-left" data-used="{% widthratio deployed_nodes|length total_nodes|length 100 %}"></div>
<div class="pull-left">
{% widthratio deployed_nodes|length total_nodes|length 100 %}% {% trans 'Deployed' %} <br />
{% widthratio free_nodes|length total_nodes|length 100 %}% {% trans 'Free' %}
@ -84,7 +84,7 @@
<div class="clear"></div>
<div class="widget">
<h2>{% trans 'Power Status' %}</h2>
<div class="d3_pie_chart pull-left" data-used="{% widthratio total_nodes_up|length total_nodes|length 100 %}"></div>
<div class="d3_pie_chart_usage pull-left" data-used="{% widthratio total_nodes_up|length total_nodes|length 100 %}"></div>
<div class="pull-left">
{% widthratio total_nodes_up|length total_nodes|length 100 %}% {% trans 'Running' %} <br />
{% widthratio total_nodes_down|length total_nodes|length 100 %}% {% trans 'Stopped' %}

View File

@ -59,7 +59,7 @@ def _get_role_data(overcloud, role):
class OverviewTab(tabs.Tab):
name = _("Overview")
slug = "overview"
template_name = ("infrastructure/overcloud/_detail_overview.html")
template_name = "infrastructure/overcloud/_detail_overview.html"
preload = False
def get_context_data(self, request, **kwargs):
@ -79,31 +79,12 @@ class OverviewTab(tabs.Tab):
except IndexError:
last_event = None
# TODO(akrivoka): Simplified version for now, only send controller
# and compute node counts to template, as pie chart cannot handle
# more anyway. Fix this when pie chart supports more than 2 values.
# TODO(akrivoka): Commenting out this part for now. We need better
# pie chart support in Horizon before this can be done.
# Relevant blueprint:
# https://blueprints.launchpad.net/horizon/+spec/piechart-enhancement
#controller_count = compute_count = 0
#for rd in role_data:
# if rd['name'] == 'Controller':
# controller_count = rd.get('running_node_count', 0)
# elif rd['name'] == 'Compute':
# compute_count = rd.get('running_node_count', 0)
return {
'overcloud': overcloud,
'roles': role_data,
'progress': progress,
'dashboard_url': overcloud.dashboard_url,
'last_event': last_event,
#'controller_count': controller_count,
#'compute_count': compute_count,
#'total_count': controller_count + compute_count,
}

View File

@ -99,14 +99,7 @@
<div class="span4">
<div class="widget">
<h2>{% trans "Deployment Role Distribution" %}</h2>
<p class="muted">{% trans "Statistics currently not available." %}</p>
{% comment %}
<div class="d3_pie_chart pull-left" data-used="{% widthratio controller_count total_count 100 %}"></div>
<div class="pull-left">
{% widthratio controller_count total_count 100 %}% {% trans 'Controller' %} <br />
{% widthratio compute_count total_count 100 %}% {% trans 'Compute' %}
</div>
{% endcomment %}
<div class="d3_pie_chart_distribution pull-left" data-used="{% for role in roles %}{{ role.name }}={{ role.node_count }}{% if not forloop.last %}|{% endif %}{% endfor %}"></div>
</div>
<div class="clear"></div>
<div class="widget">

View File

@ -1,4 +1,4 @@
angular.module('horizonApp').directive('hrNumberPicker', function() {
angular.module('hz').directive('hrNumberPicker', function() {
return {
restrict: 'A',
replace: true,