This commit is contained in:
Anna Sudnitsina 2018-03-21 16:44:45 +03:00
parent 57d29ef0a3
commit 7f97e9edff

View File

@ -55,12 +55,8 @@ function displayData(a){
$("#status").html("<p>"+a.health+"</p>");
if (a.health == 'deadly.') {
deadNode = a.deadlyreason["node"];
//$('#showDeadlyDetails').click(event, openNode(event, dead_node))
$('#showDeadlyDetails').css("display","block");
console.log('hui');
console.log(a.deadlyreason["node"]);
$('#resolve').css("display","block");
$("#mountFormTrigger").addClass("w3-disabled")
} else {
$('#showDeadlyDetails').css("display","none");
@ -110,39 +106,39 @@ console.log(a.deadlyreason["node"]);
$("#mon").html("");
}
}
if (selected_node =='dead') {
var t, up_formatted;
if (a.deadlyreason["updated"] != 0) {
t = new Date(a.deadlyreason["updated"] * 1000)
up_formatted = t.getFullYear() + "/"
+ (t.getMonth() + 1) + "/"
+ t.getDate() + " "
+ t.getHours() + ":"
+ t.getMinutes() + ":"
+ t.getSeconds();
} else {
up_formatted=0;
}
deadNode = a.deadlyreason["node"];
$("#name").html(a.deadlyreason["node"]);
$("#ipv4").html(a.deadlyreason["ip"]["v4"].join("<br>"));
$("#ipv6").html(a.deadlyreason["ip"]["v6"].join("<br>"));
$("#updated").html(up_formatted);
if (a.deadlyreason["mounts"] != null) {
var mnt_block = "";
for (i in a.deadlyreason.mounts) {
var mnt = a.deadlyreason.mounts[i];
mnt_block += mnt.mountpoint + "<br>"
+ mnt.mountopts + "<br>"
+ mnt.fstype + "<br>"
+ mnt.pool + "<br>"
+ mnt.image + "<br><br>";
}
$("#mon").html(mnt_block);
} else {
$("#mon").html("");
}
}
// if (selected_node =='dead') {
// var t, up_formatted;
// if (a.deadlyreason["updated"] != 0) {
// t = new Date(a.deadlyreason["updated"] * 1000)
// up_formatted = t.getFullYear() + "/"
// + (t.getMonth() + 1) + "/"
// + t.getDate() + " "
// + t.getHours() + ":"
// + t.getMinutes() + ":"
// + t.getSeconds();
// } else {
// up_formatted=0;
// }
// deadNode = a.deadlyreason["node"];
// $("#name").html(a.deadlyreason["node"]);
// $("#ipv4").html(a.deadlyreason["ip"]["v4"].join("<br>"));
// $("#ipv6").html(a.deadlyreason["ip"]["v6"].join("<br>"));
// $("#updated").html(up_formatted);
// if (a.deadlyreason["mounts"] != null) {
// var mnt_block = "";
// for (i in a.deadlyreason.mounts) {
// var mnt = a.deadlyreason.mounts[i];
// mnt_block += mnt.mountpoint + "<br>"
// + mnt.mountopts + "<br>"
// + mnt.fstype + "<br>"
// + mnt.pool + "<br>"
// + mnt.image + "<br><br>";
// }
// $("#mon").html(mnt_block);
// } else {
// $("#mon").html("");
// }
// }
$("#leader").html(a.leader);
}
@ -152,19 +148,19 @@ console.log(nodeName);
selected_node = nodeName;
x = document.getElementsByClassName("node");
tablinks = document.getElementsByClassName("tablink");
if (selected_node == 'dead') {
// if (selected_node == deadNode) {
$('#details').css("border", "2px solid #f44336");
if ($('#showDeadlyDetails').html() == "Show details") {
$('#details').css("display", "block");
$('#showDeadlyDetails').text('Hide details');
} else {
$('#details').css("display", "none");
$('#showDeadlyDetails').text('Show details');
}
// displayData(a);
} else {
// if (selected_node == 'dead') {
// // if (selected_node == deadNode) {
// $('#details').css("border", "2px solid #f44336");
// if ($('#showDeadlyDetails').html() == "Show details") {
// $('#details').css("display", "block");
// $('#showDeadlyDetails').text('Hide details');
// } else {
// $('#details').css("display", "none");
// $('#showDeadlyDetails').text('Show details');
// }
// // displayData(a);
// } else {
$('#showDeadlyDetails').text('Show details');
$('#details').css("border", "").css("display", "block"); displayData(a);
}
// }
}