Files
poky/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js
Michael Wood 1c9ce1ca73 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>
2016-02-10 13:29:18 +00:00

29 lines
754 B
JavaScript

"use strict";
/* Used for the newcustomimage_modal actions */
function newCustomImageModalInit(){
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) {
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");
}
});
}