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