aboutsummaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js')
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js29
1 files changed, 26 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..442fe309f05 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,29 @@ 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() {
+ 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
+ function showLoadingState() {
+ 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 +191,5 @@ function newCustomImageModalSetRecipes(baseRecipes) {
// show the radio button container
imageSelector.show();
-
- }
+ }
}