]>
git.ipfire.org Git - people/shoehn/ipfire.org.git/blob - www/static/js/cluster.js
6 $.getJSON("/api/cluster_info", { id
: id
++ },
8 // If we are already busy then exit
9 if (busy
== true) return;
13 if (data
.error
!= "null") return;
17 $.each(data
.result
.nodes
, function(i
, node
) {
18 var nodeid
= node
.hostname
.replace(/\./g, "");
23 if ($("#" + nodeid
).length
) {
24 $("#" + nodeid
+ "_speed").html(node
.speed
);
26 row
= "<tr id=\"" + nodeid
+ "\" class=\"node\">";
27 row
+= " <td id=\"" + nodeid
+ "_hostname\"></td>";
28 row
+= " <td id=\"" + nodeid
+ "_arch\">" + node
.arch
+ "</td>";
29 row
+= " <td><span id=\"" + nodeid
+ "_loadbar\"></span></td>";
30 row
+= " <td><span id=\"" + nodeid
+ "_jobs\"></span></td>";
31 row
+= " <td id=\"" + nodeid
+ "_speed\">" + node
.speed
+ "</td>";
33 $("#nodes").append(row
);
35 $("#" + nodeid
+ "_loadbar").progressBar(node
.load
, {showText
: false});
36 $("#" + nodeid
+ "_jobs").progressBar(node
.jobcount
.split("/")[0], { max
: node
.jobcount
.split("/")[1], textFormat
: 'fraction'});
37 if (node
.installing
== true) {
38 $("#" + nodeid
+ "_hostname").html(node
.hostname
+ " *");
40 $("#" + nodeid
+ "_hostname").html(node
.hostname
);
44 $("#loadbar").progressBar(data
.result
.cluster
.load
);
45 $("#jobbar").progressBar(data
.result
.cluster
.jobcount
.split("/")[0], { max
: data
.result
.cluster
.jobcount
.split("/")[1], textFormat
: 'fraction'});
46 for (var nodeid
in nodes
) {
47 if (nodes
[nodeid
] == false) {
48 $("#" + nodeid
).remove();
51 nodes
[nodeid
] = false;
54 $("#count").html(count
);
59 $(document
).ready(function(){
61 $("#loadbar").progressBar();
64 setInterval("update()", 2000);