This commit is contained in:
Anna Sudnitsina 2018-03-22 13:51:13 +00:00
parent 7f97e9edff
commit 500e59fded
2 changed files with 15 additions and 4 deletions

View File

@ -67,8 +67,19 @@ function displayData(a){
$("#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);
if (node2 != undefined) {
var one = a.quorum.map(function(item) {return item.node});
var two = node2.quorum.map(function(item) {return item.node});
if (JSON.stringify(one) != JSON.stringify(two)) {
console.log('upd');
node2 = a;
w3DisplayData("id01", node2);
}
} else {
console.log('upd');
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)}})

View File

@ -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="openNode(event, '{{!node}}')">
<a w3-repeat="node in quorum" href="javascript:void(0)" class="tablink" onclick="console.log('click!'); openNode(event, '{{!node}}')">
{{!node}}
</a>
<h4>Metrics: </h4>
@ -85,7 +85,7 @@
</body>
<script>
var ws = new WebSocket('{{escape(ws)}}');
var a, selected_node, deadNode;
var a, selected_node, deadNode, node2;
ws.onopen = function() {ws.send(""); };
ws.onmessage = function (evt) {
a = JSON.parse(evt.data);