summaryrefslogtreecommitdiffstats
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
parent8b1d0438bc1dd6aeea37fb039897f8c3e023f5ce (diff)
downloadpoky-contrib-1c9ce1ca73837ea77b8a1acbb31ad83cf13a2992.tar.gz
poky-contrib-1c9ce1ca73837ea77b8a1acbb31ad83cf13a2992.tar.bz2
poky-contrib-1c9ce1ca73837ea77b8a1acbb31ad83cf13a2992.zip
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>
-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 71a28f7b2a4..16e42b3d278 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 @@
"use strict";
/* Used for the newcustomimage_modal actions */
-function newCustomImageModalInit(ctx){
+function newCustomImageModalInit(){
var newCustomImgBtn = $("#create-new-custom-image-btn");
var imgCustomModal = $("#new-custom-image-modal");
@@ -13,36 +13,16 @@ function newCustomImageModalInit(ctx){
var baseRecipeId = imgCustomModal.data('recipe');
if (name.length > 0) {
- createCustomRecipe(name, baseRecipeId);
imgCustomModal.modal('hide');
+ libtoaster.createCustomRecipe(name, baseRecipeId, function(ret) {
+ if (ret.error !== "ok") {
+ console.warn(ret.error);
+ } else {
+ window.location.replace(ret.url + '?notify=new');
+ }
+ });
} else {
console.warn("TODO No name supplied");
}
});
-
- function createCustomRecipe(name, baseRecipeId){
- var data = {
- 'name' : name,
- 'project' : libtoaster.ctx.projectId,
- 'base' : baseRecipeId,
- };
-
- $.ajax({
- type: "POST",
- url: ctx.xhrCustomRecipeUrl,
- data: data,
- headers: { 'X-CSRFToken' : $.cookie('csrftoken')},
- success: function (ret) {
- if (ret.error !== "ok") {
- console.warn(ret.error);
- } else {
- window.location.replace(ret.url + '?notify=new');
- }
- },
- error: function (ret) {
- console.warn("Call failed");
- console.warn(ret);
- }
- });
- }
}