From c091bc7ee241aa72b3159e504b9fc9f8f6aeb665 Mon Sep 17 00:00:00 2001 From: Anna Date: Fri, 1 Sep 2017 17:42:27 +0300 Subject: [PATCH] v1.0 --- rbmd/static/script.js | 35 ++++++++----------- rbmd/templates/rbmd/index.html | 16 ++++----- rbmd/urls.py | 1 - rbmd/views.py | 61 +++++++++++++--------------------- 4 files changed, 43 insertions(+), 70 deletions(-) diff --git a/rbmd/static/script.js b/rbmd/static/script.js index d8916a6..dbc8213 100644 --- a/rbmd/static/script.js +++ b/rbmd/static/script.js @@ -6,9 +6,8 @@ $(function() { var status = JSON.parse(data); var htmlSelect = ''; for (n in status["quorum"]) { htmlSelect += "";} - $('#selectNode').html(htmlSelect); - console.log(htmlSelect);} + } }) }) @@ -16,7 +15,7 @@ $(function() { function resolve() { $.ajax({ - url:"/resolve", + url:"resolve", data:{"node":deadNode}, success:function(data){$('#details').css("display", "none");} }) @@ -40,12 +39,6 @@ $(function() { } } - - - - - - function displayData(a){ $("#status").html("

"+a.health+"

"); if (a.health == 'deadly.') { @@ -68,23 +61,23 @@ $(function() { }; w3DisplayData("id01", node2); $('.tablink').css('display', 'block'); - if (n != undefined && n != 'dead'){ - var t = new Date(a.quorum[n]["updated"] * 1000) + if (selected_node != undefined && selected_node != 'dead'){ + var t = new Date(a.quorum[selected_node]["updated"] * 1000) var up_formatted = t.getFullYear() + "/" + (t.getMonth() + 1) + "/" + t.getDate() + " " + t.getHours() + ":" + t.getMinutes() + ":" + t.getSeconds(); - $("#name").html(n); - $("#ipv4").html(a.quorum[n]["ip"]["v4"].join("
")); - $("#ipv6").html(a.quorum[n]["ip"]["v6"].join("
")); + $("#name").html(selected_node); + $("#ipv4").html(a.quorum[selected_node]["ip"]["v4"].join("
")); + $("#ipv6").html(a.quorum[selected_node]["ip"]["v6"].join("
")); $("#updated").html(up_formatted); - if (a.quorum[n]["mounts"] != null) { + if (a.quorum[selected_node]["mounts"] != null) { var mnt_block = ""; - for (i in a.quorum[n].mounts) { - var mnt = a.quorum[n].mounts[i]; - mnt_block += "unmount
Mountpoint: " + for (i in a.quorum[selected_node].mounts) { + var mnt = a.quorum[selected_node].mounts[i]; + mnt_block += "unmount
Mountpoint: " + mnt.mountpoint + "
Mountopts: " + mnt.mountopts + "
Fstype: " + mnt.fstype + @@ -96,7 +89,7 @@ $(function() { } else { $("#mon").html("")} } - if (n =='dead') { + if (selected_node =='dead') { var t, up_formatted if (a.deadlyreason["updated"] != 0) { t = new Date(a.deadlyreason["updated"] * 1000) @@ -119,10 +112,10 @@ $(function() { } function openNode(evt, nodeName) { var i, x, tablinks; - n = nodeName; + selected_node = nodeName; x = document.getElementsByClassName("node"); tablinks = document.getElementsByClassName("tablink"); - if (n == 'dead') { + if (selected_node == 'dead') { $('#details').css("border", "2px solid #f44336"); if ($('#showDeadlyDetails').html() == "Show details") { $('#details').css("display", "block"); diff --git a/rbmd/templates/rbmd/index.html b/rbmd/templates/rbmd/index.html index 6f12238..c1be53b 100644 --- a/rbmd/templates/rbmd/index.html +++ b/rbmd/templates/rbmd/index.html @@ -24,9 +24,9 @@ {% endverbatim %}

Metrics:

- {% for k,v in metrics.items %} {{k}} {{v}}
{% endfor %} +
Status...
@@ -55,7 +55,7 @@
- × + ×

Mount

{% csrf_token %} @@ -72,14 +72,12 @@
- +