This commit is contained in:
Anna Sudnitsina 2018-03-26 22:08:59 +03:00
parent bbc431c5e0
commit 177abc3e03
2 changed files with 48 additions and 24 deletions

View File

@ -18,6 +18,30 @@ $(function() {
*/ */
}) })
$('.tablink').css('display', 'block') $('.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 = "<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" )
}
}
})
})
}); });
function resolve() { 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); var u = confirm(a + ": confirm unmount of " + b);
if (u == true) { if (u == true) {
$.ajax({ $.ajax({

View File

@ -91,28 +91,28 @@
a = JSON.parse(evt.data); a = JSON.parse(evt.data);
displayData(a); displayData(a);
}; };
//
$('#mountForm').submit(function(event){ // $('#mountForm').submit(function(event){
event.preventDefault(); // event.preventDefault();
$.ajax({ // $.ajax({
url:"mount", // url:"mount",
data:$(this).serialize(), // data:$(this).serialize(),
method:'POST', // method:'POST',
success:function(data){ // success:function(data){
$('#mount').css('display', 'none'); // $('#mount').css('display', 'none');
$('input[type = "text"]').val(''); // $('input[type = "text"]').val('');
var res = JSON.parse(data); // var res = JSON.parse(data);
message = "<h3>" + res["state"] + "</h3> <p>"+ res["message"] +"</p>"; // message = "<h3>" + res["state"] + "</h3> <p>"+ res["message"] +"</p>";
$("#rspContainer").css("display", "block"); // $("#rspContainer").css("display", "block");
$("#rsp").html(message) // $("#rsp").html(message)
if (res["state"] == 'OK'){ // if (res["state"] == 'OK'){
$("#rspContainer").css("background-color", "#4CAF50" ); // $("#rspContainer").css("background-color", "#4CAF50" );
} // }
else { // else {
$("#rspContainer").css("background-color", "#f44336" ) // $("#rspContainer").css("background-color", "#f44336" )
} // }
} // }
}) // })
}) // })
</script> </script>
</html> </html>