Add node counts to the plan edit view
Change-Id: I531095cb150e9c09e8a3d8c9e43ffd039981120d
This commit is contained in:
@@ -38,18 +38,21 @@ tuskar.boxes = (function () {
|
|||||||
var role = 0;
|
var role = 0;
|
||||||
$flavor.find('div.boxes-nodes div.boxes-node').each(function () {
|
$flavor.find('div.boxes-nodes div.boxes-node').each(function () {
|
||||||
var $this = $(this);
|
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]]) {
|
while (count >= roles[role_names[role]]) {
|
||||||
role += 1;
|
role += 1;
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
if (!role_names[role]) {
|
if (!role_names[role]) {
|
||||||
$(this).html('free');
|
$(this).html('free');
|
||||||
|
$(this).addClass('boxes-role-none');
|
||||||
} else {
|
} else {
|
||||||
$this.addClass('boxes-role-' + role_names[role]).html(' ');
|
$this.addClass('boxes-role-' + role_names[role]).html(' ');
|
||||||
}
|
}
|
||||||
count += 1;
|
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() {
|
function update_boxes() {
|
||||||
|
@@ -99,3 +99,16 @@
|
|||||||
background-color: #999;
|
background-color: #999;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.free-nodes {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.separator-line {
|
||||||
|
border-bottom: 1px solid #999;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.boxes-flavor {
|
||||||
|
padding-bottom: 10px;
|
||||||
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
<div
|
<div
|
||||||
class="boxes-node"
|
class="boxes-node boxes-role-none"
|
||||||
data-toggle="popover"
|
data-toggle="popover"
|
||||||
title="{{ node.role_name|title|default:_('Free') }} {% trans 'node' %}"
|
title="{{ node.role_name|title|default:_('Free') }} {% trans 'node' %}"
|
||||||
data-content="<dl>
|
data-content="<dl>
|
||||||
|
@@ -26,14 +26,27 @@
|
|||||||
<h4>{% trans "Available Flavors" %}</h4>
|
<h4>{% trans "Available Flavors" %}</h4>
|
||||||
{% for flavor in flavors %}
|
{% for flavor in flavors %}
|
||||||
<div class="boxes-flavor" data-flavor="{{ flavor.name }}">
|
<div class="boxes-flavor" data-flavor="{{ flavor.name }}">
|
||||||
<p>
|
<div class="row">
|
||||||
<strong>{% trans "Flavor:" %}</strong>
|
<div class="col-md-9">
|
||||||
<i>{{ flavor.name }}</i>
|
<strong>{% trans "Flavor:" %}</strong>
|
||||||
{{ flavor.cpu_arch }},
|
<i>{{ flavor.name }}</i>
|
||||||
{{ flavor.vcpus }} CPU,
|
{{ flavor.cpu_arch }},
|
||||||
{{ flavor.ram }}MB RAM,
|
{{ flavor.vcpus }} CPU,
|
||||||
{{ flavor.disk }}GB Disk
|
{{ flavor.ram }}MB RAM,
|
||||||
</p>
|
{{ 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="row">
|
||||||
<div class="col-xs-5">
|
<div class="col-xs-5">
|
||||||
<div class="boxes-drop-roles">
|
<div class="boxes-drop-roles">
|
||||||
|
Reference in New Issue
Block a user