105 lines
5.1 KiB
HTML
105 lines
5.1 KiB
HTML
<html>
|
|
<head>
|
|
<title>RBMD</title>
|
|
<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">
|
|
<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="{{ 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">
|
|
</head>
|
|
<body>
|
|
<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 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>
|
|
</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>
|
|
<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>
|
|
var ws = new WebSocket('{{escape(ws)}}');
|
|
var a, selected_node, deadNode;
|
|
ws.onopen = function() {ws.send(""); };
|
|
ws.onmessage = function (evt) {
|
|
a = JSON.parse(evt.data);
|
|
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" )}
|
|
|
|
}
|
|
})
|
|
})
|
|
|
|
</script>
|
|
</body></html>
|