From 177abc3e0389dfa8fa2d248e3d40deb59f863e5a Mon Sep 17 00:00:00 2001 From: Anna Date: Mon, 26 Mar 2018 22:08:59 +0300 Subject: [PATCH] upd --- static/rbmd/script.js | 26 +++++++++++++++++++++- templates/rbmd/index.html | 46 +++++++++++++++++++-------------------- 2 files changed, 48 insertions(+), 24 deletions(-) diff --git a/static/rbmd/script.js b/static/rbmd/script.js index 9fdc87f..7a77677 100644 --- a/static/rbmd/script.js +++ b/static/rbmd/script.js @@ -18,6 +18,30 @@ $(function() { */ }) $('.tablink').css('display', 'block') + + $('#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 = "

" + res["state"] + "

"+ res["message"] +"

"; + $("#rspContainer").css("display", "block"); + $("#rsp").html(message) + if (res["state"] == 'OK'){ + $("#rspContainer").css("background-color", "#4CAF50" ); + } + else { + $("#rspContainer").css("background-color", "#f44336" ) + } + } + }) + }) + }); function resolve() { @@ -30,7 +54,7 @@ function resolve() { }) } -function unmount(a, b, c) { +function unmount(a, b, c) { //selected_node, mountpoint, block var u = confirm(a + ": confirm unmount of " + b); if (u == true) { $.ajax({ diff --git a/templates/rbmd/index.html b/templates/rbmd/index.html index c27c345..e66547e 100644 --- a/templates/rbmd/index.html +++ b/templates/rbmd/index.html @@ -91,28 +91,28 @@ 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 = "

" + res["state"] + "

"+ res["message"] +"

"; - $("#rspContainer").css("display", "block"); - $("#rsp").html(message) - if (res["state"] == 'OK'){ - $("#rspContainer").css("background-color", "#4CAF50" ); - } - else { - $("#rspContainer").css("background-color", "#f44336" ) - } - } - }) - }) + // + // $('#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 = "

" + res["state"] + "

"+ res["message"] +"

"; + // $("#rspContainer").css("display", "block"); + // $("#rsp").html(message) + // if (res["state"] == 'OK'){ + // $("#rspContainer").css("background-color", "#4CAF50" ); + // } + // else { + // $("#rspContainer").css("background-color", "#f44336" ) + // } + // } + // }) + // })