From fe12b9e688221dbe9a02e4e017e3977ab7ee3253 Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Fri, 15 Sep 2017 18:32:11 +0200 Subject: [PATCH] Added simple error handling case --- hosting/static/hosting/js/virtual_machine_detail.js | 8 ++++++++ hosting/templates/hosting/order_detail.html | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/hosting/static/hosting/js/virtual_machine_detail.js b/hosting/static/hosting/js/virtual_machine_detail.js index d9345e0c..7ea408ae 100644 --- a/hosting/static/hosting/js/virtual_machine_detail.js +++ b/hosting/static/hosting/js/virtual_machine_detail.js @@ -1,6 +1,7 @@ $(document).ready(function () { var create_vm_form = $('#virtual_machine_create_form'); create_vm_form.submit(function () { + $('#btn-create-vm').prop('disabled', true); $.ajax({ url: create_vm_form.attr('action'), type: 'POST', @@ -16,6 +17,13 @@ $(document).ready(function () { window.location = data.redirect; }) } + }, + error: function (xmlhttprequest, textstatus, message) { + fa_icon = $('.modal-icon > .fa'); + fa_icon.attr('class', 'fa fa-error'); + $('.modal-header > .close').attr('class', 'close'); + $('#createvm-modal-title').text(create_vm_error_message); + $('#btn-create-vm').prop('disabled', false); } }); return false; diff --git a/hosting/templates/hosting/order_detail.html b/hosting/templates/hosting/order_detail.html index 3b46f566..2a3c32b7 100644 --- a/hosting/templates/hosting/order_detail.html +++ b/hosting/templates/hosting/order_detail.html @@ -202,7 +202,7 @@