summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2015-12-07 18:44:37 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-10 13:29:18 +0000
commit1c9ce1ca73837ea77b8a1acbb31ad83cf13a2992 (patch)
tree5665a899a3b7773ef21fbdeac69423aa254926c2 /bitbake
parent8b1d0438bc1dd6aeea37fb039897f8c3e023f5ce (diff)
downloadpoky-1c9ce1ca73837ea77b8a1acbb31ad83cf13a2992.tar.gz
bitbake: toaster: newcustomimage_modal use libtoaster method for new CustomRecipe
Use libtoaster.createCustomRecipe rather than own implementation of this function. (Bitbake rev: 74fa98752b1cf1ad18d35ab6dd25fe7e409133c5) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: brian avery <avery.brian@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js36
1 files changed, 8 insertions, 28 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js b/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js
index 71a28f7b2a..16e42b3d27 100644
--- a/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js
+++ b/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js
@@ -1,7 +1,7 @@
1"use strict"; 1"use strict";
2 2
3/* Used for the newcustomimage_modal actions */ 3/* Used for the newcustomimage_modal actions */
4function newCustomImageModalInit(ctx){ 4function newCustomImageModalInit(){
5 5
6 var newCustomImgBtn = $("#create-new-custom-image-btn"); 6 var newCustomImgBtn = $("#create-new-custom-image-btn");
7 var imgCustomModal = $("#new-custom-image-modal"); 7 var imgCustomModal = $("#new-custom-image-modal");
@@ -13,36 +13,16 @@ function newCustomImageModalInit(ctx){
13 var baseRecipeId = imgCustomModal.data('recipe'); 13 var baseRecipeId = imgCustomModal.data('recipe');
14 14
15 if (name.length > 0) { 15 if (name.length > 0) {
16 createCustomRecipe(name, baseRecipeId);
17 imgCustomModal.modal('hide'); 16 imgCustomModal.modal('hide');
17 libtoaster.createCustomRecipe(name, baseRecipeId, function(ret) {
18 if (ret.error !== "ok") {
19 console.warn(ret.error);
20 } else {
21 window.location.replace(ret.url + '?notify=new');
22 }
23 });
18 } else { 24 } else {
19 console.warn("TODO No name supplied"); 25 console.warn("TODO No name supplied");
20 } 26 }
21 }); 27 });
22
23 function createCustomRecipe(name, baseRecipeId){
24 var data = {
25 'name' : name,
26 'project' : libtoaster.ctx.projectId,
27 'base' : baseRecipeId,
28 };
29
30 $.ajax({
31 type: "POST",
32 url: ctx.xhrCustomRecipeUrl,
33 data: data,
34 headers: { 'X-CSRFToken' : $.cookie('csrftoken')},
35 success: function (ret) {
36 if (ret.error !== "ok") {
37 console.warn(ret.error);
38 } else {
39 window.location.replace(ret.url + '?notify=new');
40 }
41 },
42 error: function (ret) {
43 console.warn("Call failed");
44 console.warn(ret);
45 }
46 });
47 }
48} 28}