bitbake: toaster: libtoaster Add createCustomRecipe method

This adds the function to call the ReSt API to create a custom image
recipe.

(Bitbake rev: 03e7949f538733f682a05d0c318cf2f4cd64cbf5)

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>
This commit is contained in:
Michael Wood 2015-12-07 18:43:15 +00:00 committed by Richard Purdie
parent 32048fa71f
commit 8b1d0438bc
2 changed files with 28 additions and 0 deletions

View File

@ -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,
};
})();

View File

@ -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,