mirror of
https://git.yoctoproject.org/poky
synced 2026-02-10 18:53:13 +01:00
Add the Image customisation front end feature to Toaster. Caveat - This feature is currently in development and should not be enabled by default. (Bitbake rev: 543586462b66434741f47f2884b4ccdeda5397b5) 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>
50 lines
1.1 KiB
JavaScript
50 lines
1.1 KiB
JavaScript
"use strict";
|
|
|
|
function newCustomImagePageInit(ctx){
|
|
|
|
var newCustomImgBtn = $("#create-new-custom-image-btn");
|
|
var imgCustomModal = $("#new-custom-image-modal");
|
|
|
|
newCustomImgBtn.click(function(e){
|
|
e.preventDefault();
|
|
|
|
var name = imgCustomModal.find('input').val();
|
|
var baseRecipeId = imgCustomModal.data('recipe');
|
|
|
|
if (name.length > 0) {
|
|
createCustomRecipe(name, baseRecipeId);
|
|
imgCustomModal.modal('hide');
|
|
} 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);
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
}
|