summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js
diff options
context:
space:
mode:
authorElliot Smith <elliot.smith@intel.com>2016-04-19 17:28:46 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-04-19 21:11:26 +0100
commit1cf8f215b3543ce0f39ebd3321d58cfb518f1c1f (patch)
treeac2ec1be24db0eb3f845d53cfa7ce6c18c36ab70 /bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js
parenta40a3e6defefd69521a417a366b8752be7e778f9 (diff)
downloadpoky-1cf8f215b3543ce0f39ebd3321d58cfb518f1c1f.tar.gz
bitbake: toaster: add modal to select custom image for editing
Add functionality to the placeholder button on the build dashboard to open a modal dialog displaying editable custom images, in cases where multiple custom images were built by the build. Where there is only one editable custom image, go direct to its edit page. The images shown in the modal are custom recipes for the project which were built during the build shown in the dashboard. This also affects the new custom image dialog, as that also has to show custom image recipes as well as image recipes built during the build. Modify the API on the Build object to support both. Also modify and rename the queryset_to_list template filter so that it can deal with lists as well as querysets, as the new custom image modal has to show a list of image recipes which is an amalgam of two querysets. [YOCTO #9123] (Bitbake rev: 8c2aea3fa8e1071de60390e86e2536904fa9b7c0) Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js')
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js15
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
12to select the base image (or remove the radio buttons, if there is only a 12to select the base image (or remove the radio buttons, if there is only a
13single base image available). 13single base image available).
14*/ 14*/
15
15function newCustomImageModalInit(){ 16function 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);