Add node counts to the plan edit view

Change-Id: I531095cb150e9c09e8a3d8c9e43ffd039981120d
This commit is contained in:
Ana Krivokapic
2014-12-04 18:05:58 +01:00
parent 10f7fa4a95
commit fea1a5e9a5
4 changed files with 39 additions and 10 deletions

View File

@@ -38,18 +38,21 @@ tuskar.boxes = (function () {
var role = 0;
$flavor.find('div.boxes-nodes div.boxes-node').each(function () {
var $this = $(this);
$this.removeClass('boxes-role-controller boxes-role-compute boxes-role-cinder-storage boxes-role-swift-storage');
$this.removeClass('boxes-role-controller boxes-role-compute boxes-role-cinder-storage boxes-role-swift-storage boxes-role-none');
while (count >= roles[role_names[role]]) {
role += 1;
count = 0;
}
if (!role_names[role]) {
$(this).html('free');
$(this).addClass('boxes-role-none');
} else {
$this.addClass('boxes-role-' + role_names[role]).html(' ');
}
count += 1;
});
var free_nodes = $flavor.find('div.boxes-nodes div.boxes-role-none').length;
$flavor.find('span.free-nodes').text(free_nodes);
}
function update_boxes() {

View File

@@ -99,3 +99,16 @@
background-color: #999;
border-style: solid;
}
.free-nodes {
font-weight: bold;
}
.separator-line {
border-bottom: 1px solid #999;
margin-bottom: 5px;
}
.boxes-flavor {
padding-bottom: 10px;
}

View File

@@ -1,6 +1,6 @@
{% load i18n %}
<div
class="boxes-node"
class="boxes-node boxes-role-none"
data-toggle="popover"
title="{{ node.role_name|title|default:_('Free') }} {% trans 'node' %}"
data-content="<dl>

View File

@@ -26,14 +26,27 @@
<h4>{% trans "Available Flavors" %}</h4>
{% for flavor in flavors %}
<div class="boxes-flavor" data-flavor="{{ flavor.name }}">
<p>
<strong>{% trans "Flavor:" %}</strong>
<i>{{ flavor.name }}</i>
{{ flavor.cpu_arch }},
{{ flavor.vcpus }} CPU,
{{ flavor.ram }}MB RAM,
{{ flavor.disk }}GB Disk
</p>
<div class="row">
<div class="col-md-9">
<strong>{% trans "Flavor:" %}</strong>
<i>{{ flavor.name }}</i>
{{ flavor.cpu_arch }},
{{ flavor.vcpus }} CPU,
{{ flavor.ram }}MB RAM,
{{ flavor.disk }}GB Disk
</div>
<div class="col-md-3">
<span class="pull-right">
{% trans "Free Nodes:" %}
<span class="free-nodes"></span> / {{ flavor.nodes|length }}
</span>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="separator-line"></div>
</div>
</div>
<div class="row">
<div class="col-xs-5">
<div class="boxes-drop-roles">