diff options
author | Michael Wood <michael.g.wood@intel.com> | 2015-12-07 18:43:15 +0000 |
---|---|---|
committer | Michael Wood <michael.g.wood@intel.com> | 2016-02-08 17:35:46 +0000 |
commit | 03e7949f538733f682a05d0c318cf2f4cd64cbf5 (patch) | |
tree | 70531b2913855a8ed25c3d190ba7095db177530c /lib/toaster/toastergui | |
parent | 8b03bbae12ec077151c97579e329d89667040a78 (diff) | |
download | bitbake-03e7949f538733f682a05d0c318cf2f4cd64cbf5.tar.gz |
toaster: libtoaster Add createCustomRecipe method
This adds the function to call the ReSt API to create a custom image
recipe.
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: brian avery <avery.brian@gmail.com>
Diffstat (limited to 'lib/toaster/toastergui')
-rw-r--r-- | lib/toaster/toastergui/static/js/libtoaster.js | 27 | ||||
-rw-r--r-- | lib/toaster/toastergui/templates/base.html | 1 |
2 files changed, 28 insertions, 0 deletions
diff --git a/lib/toaster/toastergui/static/js/libtoaster.js b/lib/toaster/toastergui/static/js/libtoaster.js index 101203440..e81f56705 100644 --- a/lib/toaster/toastergui/static/js/libtoaster.js +++ b/lib/toaster/toastergui/static/js/libtoaster.js @@ -332,6 +332,32 @@ var libtoaster = (function (){ $("#change-notification, #change-notification *").fadeIn(); } + function _createCustomRecipe(name, baseRecipeId, doneCb){ + var data = { + 'name' : name, + 'project' : libtoaster.ctx.projectId, + 'base' : baseRecipeId, + }; + + $.ajax({ + type: "POST", + url: libtoaster.ctx.xhrCustomRecipeUrl, + data: data, + headers: { 'X-CSRFToken' : $.cookie('csrftoken')}, + success: function (ret) { + if (doneCb){ + doneCb(ret); + } else if (ret.error !== "ok") { + console.warn(ret.error); + } + }, + error: function (ret) { + console.warn("Call failed"); + console.warn(ret); + } + }); + } + return { reload_params : reload_params, @@ -347,6 +373,7 @@ var libtoaster = (function (){ addRmLayer : _addRmLayer, makeLayerAddRmAlertMsg : _makeLayerAddRmAlertMsg, showChangeNotification : _showChangeNotification, + createCustomRecipe: _createCustomRecipe, }; })(); diff --git a/lib/toaster/toastergui/templates/base.html b/lib/toaster/toastergui/templates/base.html index e56bb34e3..6994bcc9a 100644 --- a/lib/toaster/toastergui/templates/base.html +++ b/lib/toaster/toastergui/templates/base.html @@ -45,6 +45,7 @@ machinesTypeAheadUrl: {% url 'xhr_machinestypeahead' project.id as paturl%}{{paturl|json}}, projectBuildsUrl: {% url 'projectbuilds' project.id as pburl %}{{pburl|json}}, + xhrCustomRecipeUrl : "{% url 'xhr_customrecipe' %}", projectId : {{project.id}}, {% else %} projectId : undefined, |