vpn-status/assets/app.js
2013-10-04 00:19:10 +02:00

24 lines
739 B
JavaScript

$(function() {
$("#nodeTable tr[data-node]").each(function(){
var $this = $(this);
var node = $this.data("node");
$.getJSON("/status/"+node, function (data) {
$this.find("span.loading").hide();
var label;
if (data["Status"] === "UP") {
label = "label-success";
$this.addClass("success");
$this.find("td.ping").text(data["Ping"] + "ms");
} else if (data["Status"] === "SLOW") {
label = "label-warning";
$this.addClass("warning");
$this.find("td.ping").text(data["Ping"] + "ms");
} else {
label = "label-danger";
$this.addClass("danger");
}
$this.find("span.status").addClass(label).text(data["Status"]);
})
});
})