summaryrefslogtreecommitdiffstats
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.js33
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 8356c02b5a..dace8e3258 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(){
25 var duplicateNameMsg = "An image with this name already exists. Image names must be unique."; 25 var duplicateNameMsg = "An image with this name already exists. Image names must be unique.";
26 var duplicateImageInProjectMsg = "An image with this name already exists in this project." 26 var duplicateImageInProjectMsg = "An image with this name already exists in this project."
27 var invalidBaseRecipeIdMsg = "Please select an image to customise."; 27 var invalidBaseRecipeIdMsg = "Please select an image to customise.";
28 28
29 // set button to "submit" state and enable text entry so user can
30 // enter the custom recipe name
31 showSubmitState();
32
29 /* capture clicks on radio buttons inside the modal; when one is selected, 33 /* capture clicks on radio buttons inside the modal; when one is selected,
30 * set the recipe on the modal 34 * set the recipe on the modal
31 */ 35 */
@@ -40,6 +44,9 @@ function newCustomImageModalInit(){
40 }); 44 });
41 45
42 newCustomImgBtn.click(function(e){ 46 newCustomImgBtn.click(function(e){
47 // disable the button and text entry
48 showLoadingState();
49
43 e.preventDefault(); 50 e.preventDefault();
44 51
45 var baseRecipeId = imgCustomModal.data('recipe'); 52 var baseRecipeId = imgCustomModal.data('recipe');
@@ -69,12 +76,33 @@ function newCustomImageModalInit(){
69 } 76 }
70 } else { 77 } else {
71 imgCustomModal.modal('hide'); 78 imgCustomModal.modal('hide');
79 imgCustomModal.one('hidden.bs.modal', showSubmitState);
72 window.location.replace(ret.url + '?notify=new'); 80 window.location.replace(ret.url + '?notify=new');
73 } 81 }
74 }); 82 });
75 } 83 }
76 }); 84 });
77 85
86 // enable text entry, show "Create image" button text
87 function showSubmitState() {
88 libtoaster.enableAjaxLoadingTimer();
89 newCustomImgBtn.find('[data-role="loading-state"]').hide();
90 newCustomImgBtn.find('[data-role="submit-state"]').show();
91 newCustomImgBtn.removeAttr('disabled');
92 nameInput.removeAttr('disabled');
93 }
94
95 // disable text entry, show "Creating image..." button text;
96 // we also disabled the page-level ajax loading spinner while this spinner
97 // is active
98 function showLoadingState() {
99 libtoaster.disableAjaxLoadingTimer();
100 newCustomImgBtn.find('[data-role="submit-state"]').hide();
101 newCustomImgBtn.find('[data-role="loading-state"]').show();
102 newCustomImgBtn.attr('disabled', 'disabled');
103 nameInput.attr('disabled', 'disabled');
104 }
105
78 function showNameError(text){ 106 function showNameError(text){
79 invalidNameHelp.text(text); 107 invalidNameHelp.text(text);
80 invalidNameHelp.show(); 108 invalidNameHelp.show();
@@ -167,6 +195,5 @@ function newCustomImageModalSetRecipes(baseRecipes) {
167 195
168 // show the radio button container 196 // show the radio button container
169 imageSelector.show(); 197 imageSelector.show();
170 198 }
171 }
172} 199}