diff options
Diffstat (limited to 'bitbake/lib/toaster/toastergui/static/js/customrecipe.js')
-rw-r--r-- | bitbake/lib/toaster/toastergui/static/js/customrecipe.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/customrecipe.js b/bitbake/lib/toaster/toastergui/static/js/customrecipe.js index 505a81ce60..9ea9602881 100644 --- a/bitbake/lib/toaster/toastergui/static/js/customrecipe.js +++ b/bitbake/lib/toaster/toastergui/static/js/customrecipe.js | |||
@@ -281,4 +281,36 @@ function customRecipePageInit(ctx) { | |||
281 | window.location.replace(libtoaster.ctx.projectBuildsUrl); | 281 | window.location.replace(libtoaster.ctx.projectBuildsUrl); |
282 | }); | 282 | }); |
283 | }); | 283 | }); |
284 | |||
285 | $("#delete-custom-recipe-confirmed").click(function(e){ | ||
286 | e.preventDefault(); | ||
287 | libtoaster.disableAjaxLoadingTimer(); | ||
288 | $(this).find('[data-role="submit-state"]').hide(); | ||
289 | $(this).find('[data-role="loading-state"]').show(); | ||
290 | $(this).attr("disabled", "disabled"); | ||
291 | |||
292 | $.ajax({ | ||
293 | type: 'DELETE', | ||
294 | url: ctx.recipe.xhrCustomRecipeUrl, | ||
295 | headers: { 'X-CSRFToken' : $.cookie('csrftoken')}, | ||
296 | success: function (data) { | ||
297 | if (data.error !== "ok") { | ||
298 | console.warn(data.error); | ||
299 | } else { | ||
300 | var msg = $('<span>You have deleted <strong>1</strong> custom image: <strong id="deleted-custom-image-name"></strong></span>'); | ||
301 | msg.find("#deleted-custom-image-name").text(ctx.recipe.name); | ||
302 | |||
303 | libtoaster.setNotification("custom-image-recipe-deleted", | ||
304 | msg.html()); | ||
305 | |||
306 | window.location.replace(data.gotoUrl); | ||
307 | } | ||
308 | }, | ||
309 | error: function (data) { | ||
310 | console.warn(data); | ||
311 | } | ||
312 | }); | ||
313 | }); | ||
314 | |||
315 | |||
284 | } | 316 | } |