Commit 7631dbfe authored by Leigh B Stoller's avatar Leigh B Stoller

Add a cluster status box, but needs more work. It should not be based on

the json files we use for the cluster graphs, but more like the inputs to
the cluster-status page. This will do until I have time to get back to it.
parent 6f7d1efe
......@@ -6,7 +6,9 @@ function (_, sup, moment, dashboardString)
'use strict';
var isadmin = 0;
var dashboardTemplate = _.template(dashboardString);
var clusterFiles = ["cloudlab-nofed.json", "cloudlab-fedonly.json"];
var clusterStats = {};
function initialize()
{
window.APT_OPTIONS.initialize(sup);
......@@ -70,6 +72,7 @@ function (_, sup, moment, dashboardString)
}
});
UpdateTimes();
UpdateClusterSummary();
}
var xmlthing = sup.CallServerMethod(null, "dashboard",
"GetStats", null);
......@@ -87,5 +90,56 @@ function (_, sup, moment, dashboardString)
}
/*
* Grab the JSON files and reduce it down.
*/
function UpdateClusterSummary()
{
var UpdateTable = function() {
var html = "";
$.each(clusterStats, function(name, site) {
html = html +
"<tr>" +
"<td>" + name + "</td>" +
"<td>" + site.ratio + "%" + "</td>" +
"<td>" + site.inuse + "</td>" +
"<td>" + site.total + "</td>" +
"</tr>";
});
console.info(html);
$('#cluster-status-tbody').html(html);
};
for (var index = 0; index < clusterFiles.length; index++) {
var jqxhr = $.getJSON(clusterFiles[index], function(blob) {
$.each(blob.children, function(idx, site) {
var stats = {"total" : 0,
"inuse" : 0,
"ratio" : 0,
"types" : {}};
$.each(site.children, function(idx, type) {
stats.types[type.name] =
{"total" : type.size,
"inuse" : type.howfull,
"ratio" : Math.round((type.howfull /
type.size) * 100)};
stats.total += type.size;
stats.inuse += type.howfull;
stats.ratio = Math.round((stats.inuse /
stats.total) * 100);
});
clusterStats[site.name] = stats;
});
UpdateTable();
})
.fail(function() {
console.log( "error" );
});
}
}
$(document).ready(initialize);
});
......@@ -77,6 +77,29 @@
</div>
</div>
<div class='col-sm-7'>
<div class='panel panel-default' id='cluster-status-panel'>
<div class="panel-heading">
<h5><center>Cluster Status</center></h5>
</div>
<div class='panel-body panel-body-dashboard'>
<table class="table table-condensed table-bordered table-dashboard"
id='cluster-status-table'>
<thead>
<tr>
<th>Cluster</th>
<th>% Full</th>
<th>Inuse</th>
<th>Total</th>
</tr>
</thead>
<tbody id="cluster-status-tbody"></tbody>
</table>
</div>
</div>
</div>
</div>
<div class='row'>
<div class='col-sm-10 col-sm-offset-1'>
<div class='panel panel-default' id='experiments-latest-panel'>
<div class="panel-heading">
<h5><center>Latest Experiments</center></h5>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment