From 3c5e2917604315775eebe7e62a560a853e5b1c58 Mon Sep 17 00:00:00 2001 From: Michael Wood Date: Fri, 13 Mar 2015 14:34:41 +0000 Subject: bitbake: toaster: Add cancel build to latest build section Add this functionality to the common managed_mrb_section Make sure we are using the correct version of this template in the projects template and remove now redundant code. [YOCTO #7351] (Bitbake rev: 23f1439a5d3e8f4053826794c6502eca20189054) Signed-off-by: Michael Wood Signed-off-by: Richard Purdie --- .../lib/toaster/toastergui/static/js/libtoaster.js | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'bitbake/lib/toaster/toastergui/static') diff --git a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js index 38320667dc..fcf82ac65b 100644 --- a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js +++ b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js @@ -93,6 +93,33 @@ var libtoaster = (function (){ } }); } + /* cancelABuild: + * url: xhr_projectbuild + * builds_ids: space separated list of build request ids + * onsuccess: callback for successful execution + * onfail: callback for failed execution + */ + function _cancelABuild(url, build_ids, onsuccess, onfail){ + $.ajax( { + type: "POST", + url: url, + data: { 'buildCancel': build_ids }, + headers: { 'X-CSRFToken' : $.cookie('csrftoken')}, + success: function (_data) { + if (_data.error !== "ok") { + console.warn(_data.error); + } else { + if (onsuccess !== undefined) onsuccess(_data); + } + }, + error: function (_data) { + console.warn("Call failed"); + console.warn(_data); + if (onfail) onfail(data); + } + }); + } + /* Get a project's configuration info */ function _getProjectInfo(url, projectId, onsuccess, onfail){ $.ajax({ @@ -197,6 +224,7 @@ var libtoaster = (function (){ return { reload_params : reload_params, startABuild : _startABuild, + cancelABuild : _cancelABuild, makeTypeahead : _makeTypeahead, getProjectInfo: _getProjectInfo, getLayerDepsForProject : _getLayerDepsForProject, -- cgit v1.2.3-54-g00ecf