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>
This commit is contained in:
parent
8b1d0438bc
commit
1c9ce1ca73
|
@ -1,7 +1,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/* Used for the newcustomimage_modal actions */
|
/* Used for the newcustomimage_modal actions */
|
||||||
function newCustomImageModalInit(ctx){
|
function newCustomImageModalInit(){
|
||||||
|
|
||||||
var newCustomImgBtn = $("#create-new-custom-image-btn");
|
var newCustomImgBtn = $("#create-new-custom-image-btn");
|
||||||
var imgCustomModal = $("#new-custom-image-modal");
|
var imgCustomModal = $("#new-custom-image-modal");
|
||||||
|
@ -13,36 +13,16 @@ function newCustomImageModalInit(ctx){
|
||||||
var baseRecipeId = imgCustomModal.data('recipe');
|
var baseRecipeId = imgCustomModal.data('recipe');
|
||||||
|
|
||||||
if (name.length > 0) {
|
if (name.length > 0) {
|
||||||
createCustomRecipe(name, baseRecipeId);
|
|
||||||
imgCustomModal.modal('hide');
|
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 {
|
} else {
|
||||||
console.warn("TODO No name supplied");
|
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue