rbmd_web_panel/templates/rbmd/index.html

117 lines
5.3 KiB
HTML
Raw Normal View History

2017-09-08 15:26:55 +03:00
<html>
2018-03-21 12:56:03 +03:00
<head>
2017-09-08 15:26:55 +03:00
<title>RBMD</title>
2018-03-21 12:56:03 +03:00
<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">
2018-03-21 13:46:21 +03:00
<style type="text/css">
header {padding:1% 16px;}
.w3-btn {font-size:1em;}
2018-03-21 13:54:43 +03:00
img {height: 33.82px;}
2018-03-21 13:46:21 +03:00
#statusContainer {height:50px; position:relative;}
#resolve {display: none; padding:15px;}
</style>
2018-03-21 12:56:03 +03:00
</head>
<body>
2018-03-21 13:46:21 +03:00
<header>
2018-03-21 12:56:03 +03:00
<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>
2018-03-21 13:46:21 +03:00
<a href='/'><img src="{{ static_url("images-logo.png") }}" class="w3-right w3-hover-opacity"></a>
2018-03-21 12:56:03 +03:00
</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" >
2018-03-21 13:46:21 +03:00
<div class="w3-container" id="statusContainer">
2018-03-21 12:56:03 +03:00
<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>
2018-03-21 13:46:21 +03:00
<a href="javascript:void(0)" class="w3-right" id="resolve" onClick="resolve()" style="">
2018-03-21 12:56:03 +03:00
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">&times;</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>
2017-09-08 15:26:55 +03:00
2018-03-21 12:56:03 +03:00
</div>
</div>
2017-09-08 15:26:55 +03:00
</div>
2018-03-21 12:56:03 +03:00
<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">&times;</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>
</body>
2017-09-08 15:26:55 +03:00
<script>
var ws = new WebSocket('{{escape(ws)}}');
var a, selected_node, deadNode;
ws.onopen = function() {ws.send(""); };
ws.onmessage = function (evt) {
2018-03-21 12:56:03 +03:00
a = JSON.parse(evt.data);
displayData(a);
2017-09-08 15:26:55 +03:00
};
$('#mountForm').submit(function(event){
2018-03-21 12:56:03 +03:00
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>
</html>