aboutsummaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js')
-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);
- }
- });
- }
}