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 | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js b/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js index 1ae0d34e90..cb9ed4da05 100644 --- a/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js +++ b/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js | |||
@@ -12,6 +12,7 @@ for the new custom image. This will manage the addition of radio buttons | |||
12 | to select the base image (or remove the radio buttons, if there is only a | 12 | to select the base image (or remove the radio buttons, if there is only a |
13 | single base image available). | 13 | single base image available). |
14 | */ | 14 | */ |
15 | |||
15 | function newCustomImageModalInit(){ | 16 | function newCustomImageModalInit(){ |
16 | 17 | ||
17 | var newCustomImgBtn = $("#create-new-custom-image-btn"); | 18 | var newCustomImgBtn = $("#create-new-custom-image-btn"); |
@@ -21,7 +22,8 @@ function newCustomImageModalInit(){ | |||
21 | var nameInput = imgCustomModal.find('input'); | 22 | var nameInput = imgCustomModal.find('input'); |
22 | 23 | ||
23 | var invalidNameMsg = "Image names cannot contain spaces or capital letters. The only allowed special character is dash (-)."; | 24 | var invalidNameMsg = "Image names cannot contain spaces or capital letters. The only allowed special character is dash (-)."; |
24 | var duplicateNameMsg = "An image with this name already exists. Image names must be unique."; | 25 | var duplicateNameMsg = "A recipe with this name already exists. Image names must be unique."; |
26 | var duplicateImageInProjectMsg = "An image with this name already exists in this project." | ||
25 | var invalidBaseRecipeIdMsg = "Please select an image to customise."; | 27 | var invalidBaseRecipeIdMsg = "Please select an image to customise."; |
26 | 28 | ||
27 | // capture clicks on radio buttons inside the modal; when one is selected, | 29 | // capture clicks on radio buttons inside the modal; when one is selected, |
@@ -51,9 +53,12 @@ function newCustomImageModalInit(){ | |||
51 | if (ret.error === "invalid-name") { | 53 | if (ret.error === "invalid-name") { |
52 | showNameError(invalidNameMsg); | 54 | showNameError(invalidNameMsg); |
53 | return; | 55 | return; |
54 | } else if (ret.error === "already-exists") { | 56 | } else if (ret.error === "recipe-already-exists") { |
55 | showNameError(duplicateNameMsg); | 57 | showNameError(duplicateNameMsg); |
56 | return; | 58 | return; |
59 | } else if (ret.error === "image-already-exists") { | ||
60 | showNameError(duplicateImageInProjectMsg); | ||
61 | return; | ||
57 | } | 62 | } |
58 | } else { | 63 | } else { |
59 | imgCustomModal.modal('hide'); | 64 | imgCustomModal.modal('hide'); |
@@ -112,13 +117,13 @@ function newCustomImageModalSetRecipes(baseRecipes) { | |||
112 | var imageSelector = $('#new-custom-image-modal [data-role="image-selector"]'); | 117 | var imageSelector = $('#new-custom-image-modal [data-role="image-selector"]'); |
113 | var imageSelectRadiosContainer = $('#new-custom-image-modal [data-role="image-selector-radios"]'); | 118 | var imageSelectRadiosContainer = $('#new-custom-image-modal [data-role="image-selector-radios"]'); |
114 | 119 | ||
120 | // remove any existing radio buttons + labels | ||
121 | imageSelector.remove('[data-role="image-radio"]'); | ||
122 | |||
115 | if (baseRecipes.length === 1) { | 123 | if (baseRecipes.length === 1) { |
116 | // hide the radio button container | 124 | // hide the radio button container |
117 | imageSelector.hide(); | 125 | imageSelector.hide(); |
118 | 126 | ||
119 | // remove any radio buttons + labels | ||
120 | imageSelector.remove('[data-role="image-radio"]'); | ||
121 | |||
122 | // set the single recipe ID on the modal as it's the only one | 127 | // set the single recipe ID on the modal as it's the only one |
123 | // we can build from | 128 | // we can build from |
124 | imgCustomModal.data('recipe', baseRecipes[0].id); | 129 | imgCustomModal.data('recipe', baseRecipes[0].id); |