upd
This commit is contained in:
parent
1a42e41157
commit
8a3bbcdcd7
@ -1,9 +1,10 @@
|
|||||||
$(function() {
|
$(function() {
|
||||||
$('#mountFormTrigger').click(function(event){
|
$('#mountFormTrigger').click(function(event){
|
||||||
var htmlSelect = '';
|
var htmlSelect = '';
|
||||||
a.quorum.forEach(function(item) {htmlSelect += "<option value=" + item.node + ">" + item.node + "</option>";})
|
a.quorum.forEach(function(item) {
|
||||||
|
htmlSelect += "<option value=" + item.node + ">" + item.node + "</option>";
|
||||||
|
})
|
||||||
$('#selectNode').html(htmlSelect);
|
$('#selectNode').html(htmlSelect);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url:"status",
|
url:"status",
|
||||||
@ -15,112 +16,132 @@ $(function() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
*/
|
*/
|
||||||
})
|
})
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function resolve() {
|
function resolve() {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url:"resolve",
|
url:"resolve",
|
||||||
data:{"node":deadNode},
|
data:{"node": deadNode},
|
||||||
success:function(data){$('#details').css("display", "none");}
|
success:function(data){
|
||||||
})
|
$('#details').css("display", "none");
|
||||||
}
|
|
||||||
|
|
||||||
function unmount(a, b, c) {
|
|
||||||
var u = confirm(a + ": confirm unmount of " + b);
|
|
||||||
if (u == true) {
|
|
||||||
console.log('1');
|
|
||||||
$.ajax({
|
|
||||||
url:"unmount",
|
|
||||||
data:{"node":a, "mountpoint":b, "block":c},
|
|
||||||
success:function(data){console.log(data);
|
|
||||||
|
|
||||||
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 displayData(a){
|
|
||||||
$("#status").html("<p>"+a.health+"</p>");
|
|
||||||
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("<br>"));
|
|
||||||
$("#ipv6").html(selected_node_body["ip"]["v6"].join("<br>"));
|
|
||||||
$("#updated").html(up_formatted);
|
|
||||||
if (selected_node_body["mounts"] != null) {
|
|
||||||
var mnt_block = "";
|
|
||||||
for (i in selected_node_body.mounts) {
|
|
||||||
var mnt = selected_node_body.mounts[i];
|
|
||||||
mnt_block += '<a href=\'javascript:void(0)\' onClick=\'unmount("' + selected_node + '", "'
|
|
||||||
+ selected_node_body.mounts[i].mountpoint + '", "'
|
|
||||||
+ selected_node_body.mounts[i].block + '")\' >unmount</a><br>Mountpoint: '
|
|
||||||
+ mnt.mountpoint + '<br>Mountopts: '
|
|
||||||
+ mnt.mountopts + '<br>Fstype: '
|
|
||||||
+ mnt.fstype
|
|
||||||
+ '<br>Pool: ' + mnt.pool
|
|
||||||
+ '<br>Image: ' + mnt.image
|
|
||||||
+ '<br>Block: ' + mnt.block + '<br>';
|
|
||||||
}
|
|
||||||
$("#mon").html(mnt_block);
|
|
||||||
}
|
|
||||||
else { $("#mon").html("")}
|
|
||||||
}
|
}
|
||||||
if (selected_node =='dead') {
|
})
|
||||||
var t, up_formatted
|
}
|
||||||
console.log(a.deadlyreason);
|
|
||||||
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);
|
|
||||||
|
|
||||||
|
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 = "<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 displayData(a){
|
||||||
|
$("#status").html("<p>"+a.health+"</p>");
|
||||||
|
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("<br>"));
|
||||||
|
$("#ipv6").html(selected_node_body["ip"]["v6"].join("<br>"));
|
||||||
|
$("#updated").html(up_formatted);
|
||||||
|
if (selected_node_body["mounts"] != null) {
|
||||||
|
var mnt_block = "";
|
||||||
|
for (i in selected_node_body.mounts) {
|
||||||
|
var mnt = selected_node_body.mounts[i];
|
||||||
|
mnt_block += '<a href=\'javascript:void(0)\' onClick=\'unmount("'
|
||||||
|
+ selected_node + '", "'
|
||||||
|
+ selected_node_body.mounts[i].mountpoint + '", "'
|
||||||
|
+ selected_node_body.mounts[i].block
|
||||||
|
+ '")\' >unmount</a><br>Mountpoint: '
|
||||||
|
+ mnt.mountpoint + '<br>Mountopts: '
|
||||||
|
+ mnt.mountopts + '<br>Fstype: '
|
||||||
|
+ mnt.fstype
|
||||||
|
+ '<br>Pool: ' + mnt.pool
|
||||||
|
+ '<br>Image: ' + mnt.image
|
||||||
|
+ '<br>Block: ' + mnt.block + '<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);
|
||||||
|
}
|
||||||
|
|
||||||
function openNode(evt, nodeName) {
|
function openNode(evt, nodeName) {
|
||||||
var i, x, tablinks;
|
var i, x, tablinks;
|
||||||
@ -130,11 +151,13 @@ function openNode(evt, nodeName) {
|
|||||||
if (selected_node == 'dead') {
|
if (selected_node == 'dead') {
|
||||||
$('#details').css("border", "2px solid #f44336");
|
$('#details').css("border", "2px solid #f44336");
|
||||||
if ($('#showDeadlyDetails').html() == "Show details") {
|
if ($('#showDeadlyDetails').html() == "Show details") {
|
||||||
$('#details').css("display", "block");
|
$('#details').css("display", "block");
|
||||||
$('#showDeadlyDetails').text('Hide details');
|
$('#showDeadlyDetails').text('Hide details');
|
||||||
} else {
|
} else {
|
||||||
$('#details').css("display", "none");
|
$('#details').css("display", "none");
|
||||||
$('#showDeadlyDetails').text('Show details');
|
$('#showDeadlyDetails').text('Show details');
|
||||||
}
|
}
|
||||||
} else {$('#details').css("border", "").css("display", "block"); displayData(a) }
|
} else {
|
||||||
|
$('#details').css("border", "").css("display", "block"); displayData(a);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,104 +1,109 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>RBMD</title>
|
<title>RBMD</title>
|
||||||
<meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link rel="stylesheet" href="https://www.w3schools.com/lib/w3.css">
|
<link rel="stylesheet" href="https://www.w3schools.com/lib/w3.css">
|
||||||
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
|
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
|
||||||
<script src="https://www.w3schools.com/lib/w3data.js"></script>
|
<script src="https://www.w3schools.com/lib/w3data.js"></script>
|
||||||
<script src="{{ static_url("script.js") }}"></script>
|
<script src="{{ static_url("script.js") }}"></script>
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header class = "" style="padding:1% 16px;" >
|
<header class = "" style="padding:1% 16px;">
|
||||||
<a onclick="if (a.health != 'deadly.') {$('#mount').css('display', 'block')}" style="font-size:1em" class="w3-btn" id="mountFormTrigger">Mount <i class="fa fa-hdd-o"></i></a>
|
<a onclick="if (a.health != 'deadly.') {$('#mount').css('display', 'block')}" style="font-size:1em" class="w3-btn" id="mountFormTrigger">
|
||||||
<a href='/'><img src="{{ static_url("images-logo.png") }}" class="w3-right w3-hover-opacity" height="33.82em" ></a>
|
Mount <i class="fa fa-hdd-o"></i>
|
||||||
</header>
|
</a>
|
||||||
|
<a href='/'><img src="{{ static_url("images-logo.png") }}" class="w3-right w3-hover-opacity" height="33.82em" ></a>
|
||||||
|
</header>
|
||||||
|
<div class="w3-container">
|
||||||
|
<div class="w3-row">
|
||||||
|
<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="openNode(event, '{{!node}}')" style='display:none'>
|
||||||
|
{{!node}}
|
||||||
|
</a>
|
||||||
|
<h4>Metrics: </h4>
|
||||||
|
{% for k, v in metrics.items() %} {{k}} {{v}}<br>
|
||||||
|
{% end %}
|
||||||
|
</div>
|
||||||
|
<div class="w3-col m9" >
|
||||||
|
<div class="w3-container" style="height:50px; position:relative" id="statusContainer">
|
||||||
|
<div class="w3-padding w3-display-left" id="status">Status... </div>
|
||||||
|
<a href="javascript:void(0)" class="w3-right" id="showDeadlyDetails" onClick="openNode(event, 'dead')" style="display: none; padding:15px;">
|
||||||
|
Show details
|
||||||
|
</a>
|
||||||
|
<a href="javascript:void(0)" class="w3-right" id="resolve" onClick="resolve()" style="display: none; padding:15px;">
|
||||||
|
Resolve
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div id="rspContainer" class="w3-container w3-animate-opacity" style="display: none">
|
||||||
|
<span onclick="this.parentElement.style.display='none'" class="w3-closebtn">×</span>
|
||||||
|
<div id="rsp"></div>
|
||||||
|
</div>
|
||||||
|
<div id = "details" class="w3-container" style="display:none;">
|
||||||
|
<table class='w3-table w3-bordered' id="id02">
|
||||||
|
<tr><td> Node:</td> <td><span id='name'></span></td></tr>
|
||||||
|
<tr><td> IPv4:</td> <td><span id='ipv4'></span></td></tr>
|
||||||
|
<tr><td> IPv6:</td> <td><span id='ipv6'></span></td></tr>
|
||||||
|
<tr><td> Updated:</td><td> <span id='updated'></span></td></tr>
|
||||||
|
<tr><td> Mounts:</td><td id="mon"></td></tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
<div class="w3-container">
|
</div>
|
||||||
<div class="w3-row">
|
</div>
|
||||||
<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="openNode(event, '{{!node}}')" style='display:none'>{{!node}}</a>
|
|
||||||
<h4>Metrics: </h4>
|
|
||||||
{% for k, v in metrics.items() %} {{k}} {{v}}<br> {% end %}
|
|
||||||
</div>
|
</div>
|
||||||
|
<div id="mount" class="w3-modal">
|
||||||
<div class="w3-col m9" >
|
<div class="w3-modal-content">
|
||||||
<div class="w3-container" style="height:50px; position:relative" id="statusContainer">
|
<header class="w3-container w3-light-grey">
|
||||||
<div class="w3-padding w3-display-left" id="status">Status... </div>
|
<span onclick="$('#mount').css('display', 'none')" class="w3-closebtn">×</span>
|
||||||
<a href="javascript:void(0)" class="w3-right" id="showDeadlyDetails" onClick="openNode(event, 'dead')" style="display: none; padding:15px;">Show details</a>
|
<h2>Mount</h2>
|
||||||
</div>
|
</header>
|
||||||
|
<form method="post" action="/" role="form" class="w3-container form" id="mountForm"> {% module xsrf_form_html() %}
|
||||||
<div id="rspContainer" class="w3-container w3-animate-opacity" style="display: none">
|
<label class="w3-label w3-text-black">Node: <select name="node" class="w3-select" id='selectNode'></select> </label><br>
|
||||||
<span onclick="this.parentElement.style.display='none'" class="w3-closebtn">×</span>
|
<!--label class="w3-label w3-text-black">Node: <input name="node" class="w3-input" type="text" required> </label><br-->
|
||||||
<div id="rsp">
|
<label class="w3-label w3-text-black">Pool: <input name="pool" class="w3-input" type="text"> </label><br>
|
||||||
</div>
|
<label class="w3-label w3-text-black">Image: <input name="image" class="w3-input" type="text"> </label><br>
|
||||||
</div>
|
<label class="w3-label w3-text-black">mountpoint: <input name="mountpoint" class="w3-input" type="text"> </label><br>
|
||||||
|
<label class="w3-label w3-text-black">mountopts: <input name="mountopts" class="w3-input" type="text"> </label><br>
|
||||||
<div id = "details" class="w3-container" style="display:none;">
|
<label class="w3-label w3-text-black">fstype: <input name="fstype" class="w3-input" type="text"> </label><br>
|
||||||
<table class='w3-table w3-bordered' id="id02">
|
<button class="w3-btn w3-black" type="submit">Mount</button>
|
||||||
<tr><td> Node:</td> <td> <span id='name'></span></td> </tr>
|
</form>
|
||||||
<tr><td> IPv4:</td> <td> <span id='ipv4'></span></td> </tr>
|
<footer class="w3-container w3-light-grey"></footer>
|
||||||
<tr><td> IPv6:</td> <td> <span id='ipv6'></span></td> </tr>
|
</div>
|
||||||
<tr><td> Updated:</td> <td> <span id='updated'></span></td></tr>
|
</div>
|
||||||
<tr><td> Mounts:</td> <td id="mon">
|
</div>
|
||||||
</td> </tr>
|
</body>
|
||||||
</table>
|
|
||||||
<a href="javascript:void(0)" class="w3-right" id="resolve" onClick="resolve()" style="display: none; padding:15px;">Resolve</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="mount" class="w3-modal">
|
|
||||||
<div class="w3-modal-content">
|
|
||||||
<header class="w3-container w3-light-grey">
|
|
||||||
<span onclick="$('#mount').css('display', 'none')" class="w3-closebtn">×</span>
|
|
||||||
<h2>Mount</h2>
|
|
||||||
</header>
|
|
||||||
<form method="post" action="/" role="form" class="w3-container form" id="mountForm"> {% module xsrf_form_html() %}
|
|
||||||
<label class="w3-label w3-text-black">Node: <select name="node" class="w3-select" id='selectNode'></select> </label><br>
|
|
||||||
<!--label class="w3-label w3-text-black">Node: <input name="node" class="w3-input" type="text" required> </label><br-->
|
|
||||||
<label class="w3-label w3-text-black">Pool: <input name="pool" class="w3-input" type="text"> </label><br>
|
|
||||||
<label class="w3-label w3-text-black">Image: <input name="image" class="w3-input" type="text"> </label><br>
|
|
||||||
<label class="w3-label w3-text-black">mountpoint: <input name="mountpoint" class="w3-input" type="text"> </label><br>
|
|
||||||
<label class="w3-label w3-text-black">mountopts: <input name="mountopts" class="w3-input" type="text"> </label><br>
|
|
||||||
<label class="w3-label w3-text-black">fstype: <input name="fstype" class="w3-input" type="text"> </label><br>
|
|
||||||
<button class="w3-btn w3-black" type="submit">Mount</button>
|
|
||||||
</form>
|
|
||||||
<footer class="w3-container w3-light-grey">
|
|
||||||
</footer>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var ws = new WebSocket('{{escape(ws)}}');
|
var ws = new WebSocket('{{escape(ws)}}');
|
||||||
var a, selected_node, deadNode;
|
var a, selected_node, deadNode;
|
||||||
ws.onopen = function() {ws.send(""); };
|
ws.onopen = function() {ws.send(""); };
|
||||||
ws.onmessage = function (evt) {
|
ws.onmessage = function (evt) {
|
||||||
a = JSON.parse(evt.data);
|
a = JSON.parse(evt.data);
|
||||||
displayData(a);
|
displayData(a);
|
||||||
};
|
};
|
||||||
|
|
||||||
$('#mountForm').submit(function(event){
|
$('#mountForm').submit(function(event){
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url:"mount",
|
url:"mount",
|
||||||
data:$(this).serialize(),
|
data:$(this).serialize(),
|
||||||
method:'POST',
|
method:'POST',
|
||||||
success:function(data){
|
success:function(data){
|
||||||
$('#mount').css('display', 'none');
|
$('#mount').css('display', 'none');
|
||||||
$('input[type = "text"]').val('');
|
$('input[type = "text"]').val('');
|
||||||
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>";
|
||||||
$("#rspContainer").css("display", "block");
|
$("#rspContainer").css("display", "block");
|
||||||
$("#rsp").html(message)
|
$("#rsp").html(message)
|
||||||
if (res["state"] == 'OK'){$("#rspContainer").css("background-color", "#4CAF50" );}
|
if (res["state"] == 'OK'){
|
||||||
else {$("#rspContainer").css("background-color", "#f44336" )}
|
$("#rspContainer").css("background-color", "#4CAF50" );
|
||||||
|
}
|
||||||
}
|
else {
|
||||||
})
|
$("#rspContainer").css("background-color", "#f44336" )
|
||||||
})
|
}
|
||||||
|
}
|
||||||
</script>
|
})
|
||||||
</body></html>
|
})
|
||||||
|
</script>
|
||||||
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user