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 to select the base image (or remove the radio buttons, if there is only a single base image available). */ + function newCustomImageModalInit(){ var newCustomImgBtn = $("#create-new-custom-image-btn"); @@ -21,7 +22,8 @@ function newCustomImageModalInit(){ var nameInput = imgCustomModal.find('input'); var invalidNameMsg = "Image names cannot contain spaces or capital letters. The only allowed special character is dash (-)."; - var duplicateNameMsg = "An image with this name already exists. Image names must be unique."; + var duplicateNameMsg = "A recipe 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."; // capture clicks on radio buttons inside the modal; when one is selected, @@ -51,9 +53,12 @@ function newCustomImageModalInit(){ if (ret.error === "invalid-name") { showNameError(invalidNameMsg); return; - } else if (ret.error === "already-exists") { + } else if (ret.error === "recipe-already-exists") { showNameError(duplicateNameMsg); return; + } else if (ret.error === "image-already-exists") { + showNameError(duplicateImageInProjectMsg); + return; } } else { imgCustomModal.modal('hide'); @@ -112,13 +117,13 @@ function newCustomImageModalSetRecipes(baseRecipes) { var imageSelector = $('#new-custom-image-modal [data-role="image-selector"]'); var imageSelectRadiosContainer = $('#new-custom-image-modal [data-role="image-selector-radios"]'); + // remove any existing radio buttons + labels + imageSelector.remove('[data-role="image-radio"]'); + if (baseRecipes.length === 1) { // hide the radio button container imageSelector.hide(); - // remove any radio buttons + labels - imageSelector.remove('[data-role="image-radio"]'); - // set the single recipe ID on the modal as it's the only one // we can build from imgCustomModal.data('recipe', baseRecipes[0].id); |