All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 9aab17ac authored by Leigh B Stoller's avatar Leigh B Stoller

Partial fix for the cluster summary box; this is driven from the

fed/nofed json files, but those are Mothership specific. So when not the
Mothership, use the type free/inuse counts we store in database and do
not worry about fed/nofed. Eventually want to drop use of those files,
will do that next.
parent 2d3f7750
......@@ -368,6 +368,31 @@ function Do_GetStats()
}
$dashboard["lockdown"] = $lockdown;
#
# Grab the node type counts for all clusters
#
$typecounts = array();
$query_result =
DBQueryFatal("select nickname,type,count,free ".
" from apt_aggregate_nodetypes as t ".
"left join apt_aggregates as a on a.urn=t.urn");
while ($row = mysql_fetch_array($query_result)) {
$site = $row["nickname"];
$type = $row["type"];
$blob = array("site" => $site,
"type" => $type,
"count" => $row["count"],
"free" => $row["free"]);
if (!array_key_exists($site, $typecounts)) {
$typecounts[$site] = array();
}
$typecounts[$site][$type] = $blob;
}
$dashboard["typecounts"] = $typecounts;
SPITAJAX_RESPONSE($dashboard);
}
......
......@@ -18,7 +18,7 @@ $(function ()
function DashboardLoop()
{
var callback = function(json) {
console.log(json);
//console.log(json);
if (json.code) {
console.log("Could not get dashboard data: " + json.value);
return;
......@@ -69,7 +69,7 @@ $(function ()
}
});
UpdateTimes();
UpdateClusterSummary();
UpdateClusterSummary(json.value.typecounts);
}
var xmlthing = sup.CallServerMethod(null, "dashboard",
"GetStats", null);
......@@ -90,7 +90,7 @@ $(function ()
/*
* Grab the JSON files and reduce it down.
*/
function UpdateClusterSummary()
function UpdateClusterSummary(typecounts)
{
var UpdateTable = function() {
var html = "";
......@@ -104,10 +104,35 @@ $(function ()
"<td>" + site.total + "</td>" +
"</tr>";
});
console.info(html);
//console.info(html);
$('#cluster-status-tbody').html(html);
};
if (!window.MAINSITE) {
$.each(typecounts, function(site, types) {
var stats = {"total" : 0,
"inuse" : 0,
"ratio" : 0,
"types" : {}};
$.each(types, function(type, data) {
var inuse = data.count - data.free;
var total = data.count - 0;
stats.types[data.type] =
{"total" : total,
"inuse" : inuse,
"ratio" : Math.round((inuse / total) * 100)};
stats.total += total;
stats.inuse += inuse;
stats.ratio = Math.round((stats.inuse / stats.total) * 100);
});
clusterStats[site] = stats;
});
UpdateTable();
return;
}
for (var index = 0; index < clusterFiles.length; index++) {
var jqxhr = $.getJSON(clusterFiles[index], function(blob) {
$.each(blob.children, function(idx, site) {
......
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