From: Wen Wang <wenwang(a)linux.vnet.ibm.com>
This patch fixed the bug when creating a VM user can still click on
"Create" button for multiple create which is not appropriate. Now the
button is disabled and show "Creating..." instead of "Create"
indicate
user that the creating is in progress.
Signed-off-by: Wen Wang <wenwang(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.guest_add_main.js | 8 ++++++--
ui/pages/guest-add.html.tmpl | 1 +
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/ui/js/src/kimchi.guest_add_main.js b/ui/js/src/kimchi.guest_add_main.js
index f4affbc..df76975 100644
--- a/ui/js/src/kimchi.guest_add_main.js
+++ b/ui/js/src/kimchi.guest_add_main.js
@@ -55,17 +55,21 @@ kimchi.guest_add_main = function() {
$('#form-vm-add').change(function() {
if (validateForm()) {
- $('#vm-doAdd').removeAttr('disabled');
+ $('#vm-doAdd').attr('disabled', false);
}
});
var addGuest = function(event) {
+ $('#vm-doAdd').attr('disabled', true);
+ $('#vm-doAdd').attr('style', 'display:none');
+ $('#vm-doAdding').attr('style', 'display');
var formData = $('#form-vm-add').serializeObject();
-
kimchi.createVM(formData, function() {
kimchi.listVmsAuto();
kimchi.window.close();
}, function(jqXHR, textStatus, errorThrown) {
+ $('#vm-doAdd').attr('style', 'display');
+ $('#vm-doAdding').attr('style', 'display:none');
var reason = jqXHR &&
jqXHR['responseJSON'] &&
jqXHR['responseJSON']['reason'];
diff --git a/ui/pages/guest-add.html.tmpl b/ui/pages/guest-add.html.tmpl
index e3270fb..ab26c1e 100644
--- a/ui/pages/guest-add.html.tmpl
+++ b/ui/pages/guest-add.html.tmpl
@@ -82,6 +82,7 @@
<footer>
<div class="btn-group">
<button id="vm-doAdd" class="btn-normal"
disabled="disabled" href="javascript:void(0);"><span
class="text">$_("Create")</span></button>
+ <button id="vm-doAdding" class="btn-normal"
disabled="disabled" style="display:none"
href="javascript:void(0);"><span
class="text">$_("Creating...")</span></button>
</div>
</footer>
</div>
--
1.7.1
Show replies by date
Applied. Thanks.
Regards,
Aline Manera