$(document).ready(function(){
// setup a function to grab the assignments
function getAssignments() {
$.getJSON("assignments.json", function (json) {
assignedTableBody = "";
$.each(json.fulfilled, function (type, data) {
assignedTableBody += "
";
assignedTableBody += "" + type + " | ";
assignedTableBody += "" + data.UUID + " | ";
assignedTableBody += "" + (data.pool ? data.pool : "N/A") + " | ";
assignedTableBody += "" + " | ";
assignedTableBody += "" + " | ";
assignedTableBody += "" + " | ";
assignedTableBody += "
";
});
$('#nodes-table tbody').html(assignedTableBody);
queuedTableBody = "";
$.each(json.queued, function (type, data) {
queuedTableBody += "";
queuedTableBody += "" + type + " | ";
queuedTableBody += "" + data.UUID + " | ";
queuedTableBody += "" + (data.pool ? data.pool : "N/A") + " | ";
queuedTableBody += "
";
});
$('#assignments-table tbody').html(queuedTableBody);
});
}
// do the first GET on page load
getAssignments();
// grab the new assignments JSON every two seconds
var getAssignmentsInterval = setInterval(getAssignments, 2000);
});