diff options
Diffstat (limited to 'bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js')
-rw-r--r-- | bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js b/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js index 8356c02b5a8..dace8e3258d 100644 --- a/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js +++ b/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js @@ -25,7 +25,11 @@ function newCustomImageModalInit(){ var duplicateNameMsg = "An image with this name already exists. Image names must be unique."; var duplicateImageInProjectMsg = "An image with this name already exists in this project." var invalidBaseRecipeIdMsg = "Please select an image to customise."; - + + // set button to "submit" state and enable text entry so user can + // enter the custom recipe name + showSubmitState(); + /* capture clicks on radio buttons inside the modal; when one is selected, * set the recipe on the modal */ @@ -40,6 +44,9 @@ function newCustomImageModalInit(){ }); newCustomImgBtn.click(function(e){ + // disable the button and text entry + showLoadingState(); + e.preventDefault(); var baseRecipeId = imgCustomModal.data('recipe'); @@ -69,12 +76,33 @@ function newCustomImageModalInit(){ } } else { imgCustomModal.modal('hide'); + imgCustomModal.one('hidden.bs.modal', showSubmitState); window.location.replace(ret.url + '?notify=new'); } }); } }); + // enable text entry, show "Create image" button text + function showSubmitState() { + libtoaster.enableAjaxLoadingTimer(); + newCustomImgBtn.find('[data-role="loading-state"]').hide(); + newCustomImgBtn.find('[data-role="submit-state"]').show(); + newCustomImgBtn.removeAttr('disabled'); + nameInput.removeAttr('disabled'); + } + + // disable text entry, show "Creating image..." button text; + // we also disabled the page-level ajax loading spinner while this spinner + // is active + function showLoadingState() { + libtoaster.disableAjaxLoadingTimer(); + newCustomImgBtn.find('[data-role="submit-state"]').hide(); + newCustomImgBtn.find('[data-role="loading-state"]').show(); + newCustomImgBtn.attr('disabled', 'disabled'); + nameInput.attr('disabled', 'disabled'); + } + function showNameError(text){ invalidNameHelp.text(text); invalidNameHelp.show(); @@ -167,6 +195,5 @@ function newCustomImageModalSetRecipes(baseRecipes) { // show the radio button container imageSelector.show(); - - } + } } |