$(function() { $('#mountFormTrigger').click(function(event){ var htmlSelect = ''; a.quorum.forEach(function(item) { htmlSelect += ""; }) $('#selectNode').html(htmlSelect); /* $.ajax({ url:"status", success:function(data){ var status = JSON.parse(data); var htmlSelect = ''; for (n in status["quorum"]) { htmlSelect += "";} $('#selectNode').html(htmlSelect); } }) */ }) }); function resolve() { $.ajax({ url:"resolve", data:{"node": deadNode}, success:function(data){ $('#details').css("display", "none"); } }) } function unmount(a, b, c) { var u = confirm(a + ": confirm unmount of " + b); if (u == true) { $.ajax({ url:"unmount", data:{"node":a, "mountpoint":b, "block":c}, success:function(data){ var res = JSON.parse(data); message = "
"+ res["message"] +"
"; $("#rspContainer").css("display", "block"); $("#rsp").html(message) if (res["state"] == 'OK'){ $("#rspContainer").css("background-color", "#4CAF50" ); } else { $("#rspContainer").css("background-color", "#f44336" ); } } }) } } function displayData(a){ $("#status").html(""+a.health+"
"); if (a.health == 'deadly.') { $('#showDeadlyDetails').css("display","block"); $('#resolve').css("display","block"); $("#mountFormTrigger").addClass("w3-disabled") } else { $('#showDeadlyDetails').css("display","none"); $('#resolve').css("display","none"); $("#mountFormTrigger").removeClass("w3-disabled") $('#details').css("border", "0"); } $("#statusContainer:contains('alive')").css("background-color", "#4CAF50"); $("#statusContainer:contains('resizing')").css("background-color", "#ff9800"); $("#statusContainer:contains('deadly')").css("background-color", "#f44336");; var node2 = a; w3DisplayData("id01", node2); $('.tablink').css('display', 'block'); if (selected_node != undefined && selected_node != 'dead'){ //a.quorum.forEach(function(item) {if (item.node == selected_node) { console.log(item.node)}}) var selected_node_body = a.quorum.find(function(node) { return node.node == selected_node; }); var t = new Date(selected_node_body["updated"] * 1000) var up_formatted = t.getFullYear() + "/" + (t.getMonth() + 1) + "/" + t.getDate() + " " + t.getHours() + ":" + t.getMinutes() + ":" + t.getSeconds(); $("#name").html(selected_node); $("#ipv4").html(selected_node_body["ip"]["v4"].join("