upd
This commit is contained in:
parent
eeaf3c36ac
commit
f3dcba2cf7
@ -1,5 +1,5 @@
|
||||
|
||||
var a, selected_node, deadNode, node2;
|
||||
|
||||
$(function() {
|
||||
var url = "ws://" + location.host + "/socket";
|
||||
var ws = new WebSocket(url);
|
||||
@ -10,30 +10,27 @@ $(function() {
|
||||
displayData(a);
|
||||
};
|
||||
|
||||
$('#mountForm').submit(function(event){
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
url:"mount",
|
||||
data:$(this).serialize(),
|
||||
method:'POST',
|
||||
success:function(data){
|
||||
$('#mount').css('display', 'none');
|
||||
$('input[type = "text"]').val('');
|
||||
var res = JSON.parse(data);
|
||||
message = "<h3>" + res["state"] + "</h3> <p>"+ res["message"] +"</p>";
|
||||
$("#rspContainer").css("display", "block");
|
||||
$("#rsp").html(message)
|
||||
if (res["state"] == 'OK'){
|
||||
$("#rspContainer").css("background-color", "#4CAF50" );
|
||||
}
|
||||
else {
|
||||
$("#rspContainer").css("background-color", "#f44336" )
|
||||
}
|
||||
}
|
||||
$('#mountForm').submit(function(event){
|
||||
event.preventDefault();
|
||||
$.ajax({url:"mount", data:$(this).serialize(), method:'POST',
|
||||
success:function(data){
|
||||
$('#mount').css('display', 'none');
|
||||
$('input[type = "text"]').val('');
|
||||
var res = JSON.parse(data);
|
||||
message = "<h3>" + res["state"] + "</h3> <p>"+ res["message"] +"</p>";
|
||||
$("#rspContainer").css("display", "block");
|
||||
$("#rsp").html(message)
|
||||
if (res["state"] == 'OK'){
|
||||
$("#rspContainer").css("background-color", "#4CAF50" );
|
||||
}
|
||||
else {
|
||||
$("#rspContainer").css("background-color", "#f44336" )
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
$('.tablink').css('display', 'block');
|
||||
|
||||
$('.tablink').css('display', 'block');
|
||||
|
||||
$('#mountFormTrigger').click(function(event){
|
||||
var htmlSelect = '';
|
||||
@ -41,54 +38,7 @@ $('#mountForm').submit(function(event){
|
||||
htmlSelect += "<option value=" + item.node + ">" + item.node + "</option>";
|
||||
})
|
||||
$('#selectNode').html(htmlSelect);
|
||||
/*
|
||||
$.ajax({
|
||||
url:"status",
|
||||
success:function(data){
|
||||
var status = JSON.parse(data);
|
||||
var htmlSelect = '';
|
||||
for (n in status["quorum"]) { htmlSelect += "<option value=" + n + ">" + n + "</option>";}
|
||||
$('#selectNode').html(htmlSelect);
|
||||
}
|
||||
})
|
||||
*/
|
||||
|
||||
})
|
||||
|
||||
|
||||
// var ws = new WebSocket('{{escape(ws)}}');
|
||||
// var cluster, selected_node, deadNode, node2;
|
||||
// ws.onopen = function() {ws.send(""); };
|
||||
// ws.onmessage = function (evt) {
|
||||
// cluster = JSON.parse(evt.data);
|
||||
// displayData(cluster);
|
||||
// };
|
||||
|
||||
// $('#mountForm').submit(function(event){
|
||||
//
|
||||
// event.preventDefault();
|
||||
// $.ajax({
|
||||
// url:"mount",
|
||||
// data:$(this).serialize(),
|
||||
// method:'POST',
|
||||
// success:function(data){
|
||||
// console.log(data);
|
||||
// $('#mount').css('display', 'none');
|
||||
// $('input[type = "text"]').val('');
|
||||
// var res = JSON.parse(data);
|
||||
// message = "<h3>" + res["state"] + "</h3> <p>"+ res["message"] +"</p>";
|
||||
// $("#rspContainer").css("display", "block");
|
||||
// $("#rsp").html(message)
|
||||
// if (res["state"] == 'OK'){
|
||||
// $("#rspContainer").css("background-color", "#4CAF50" );
|
||||
// }
|
||||
// else {
|
||||
// $("#rspContainer").css("background-color", "#f44336" )
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// })
|
||||
|
||||
});
|
||||
|
||||
function resolve() {
|
||||
@ -101,12 +51,12 @@ function resolve() {
|
||||
})
|
||||
}
|
||||
|
||||
function unmount(a, b, c) { //selected_node, mountpoint, block
|
||||
var u = confirm(a + ": confirm unmount of " + b);
|
||||
function unmount(node, mountpoint, block) { //selected_node, mountpoint, block
|
||||
var u = confirm(node + ": confirm unmount of " + mountpoint);
|
||||
if (u == true) {
|
||||
$.ajax({
|
||||
url:"unmount",
|
||||
data:{"node":a, "mountpoint":b, "block":c},
|
||||
data:{"node": node, "mountpoint": mountpoint, "block": block},
|
||||
success:function(data){
|
||||
var res = JSON.parse(data);
|
||||
message = "<h3>" + res["state"] + "</h3> <p>"+ res["message"] +"</p>";
|
||||
@ -229,11 +179,13 @@ function displayData(a){
|
||||
}
|
||||
|
||||
function openNode(evt, nodeName) {
|
||||
// console.log(nodeName);
|
||||
var i, x, tablinks;
|
||||
selected_node = nodeName;
|
||||
x = document.getElementsByClassName("node");
|
||||
tablinks = document.getElementsByClassName("tablink");
|
||||
if (selected_node != deadNode) {
|
||||
$('#details').css("border", "2px solid #f44336");
|
||||
}
|
||||
// if (selected_node == 'dead') {
|
||||
// // if (selected_node == deadNode) {
|
||||
// $('#details').css("border", "2px solid #f44336");
|
||||
|
@ -29,7 +29,7 @@
|
||||
<div class="sidenav w3-container w3-light-grey w3-col m3" id="id01">
|
||||
<h4> Leader: </h4> <span id='leader' class="tablink"></span>
|
||||
<h4>Nodes: </h4>
|
||||
<a w3-repeat="node in quorum" href="javascript:void(0)" class="tablink" onclick="console.log('click!'); openNode(event, '{{!node}}')">
|
||||
<a w3-repeat="node in quorum" href="javascript:void(0)" class="tablink" onclick="openNode(event, '{{!node}}')">
|
||||
{{!node}}
|
||||
</a>
|
||||
<h4>Metrics: </h4>
|
||||
|
Loading…
Reference in New Issue
Block a user