diff options
author | Michael Wood <michael.g.wood@intel.com> | 2014-11-26 15:06:47 +0000 |
---|---|---|
committer | Alexandru DAMIAN <alexandru.damian@intel.com> | 2014-12-12 11:40:47 +0000 |
commit | 5f98f245bdd381a141a018a7f9953a5510fbb4df (patch) | |
tree | 278a764e28b604920bdaf23239628a2fc5125485 /lib/toaster/toastergui/static/js/libtoaster.js | |
parent | 9e3f2e2d985a575adb5520d8b517eac5ad6a15ed (diff) | |
download | bitbake-contrib-5f98f245bdd381a141a018a7f9953a5510fbb4df.tar.gz |
toaster: libtoaster Add editProject and getLayerDepsForProject
Add two utility functions for editing project settings and returning the
layer "dependencies" for a specified layer.
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Diffstat (limited to 'lib/toaster/toastergui/static/js/libtoaster.js')
-rw-r--r-- | lib/toaster/toastergui/static/js/libtoaster.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/lib/toaster/toastergui/static/js/libtoaster.js b/lib/toaster/toastergui/static/js/libtoaster.js index b691a3bee..15815b333 100644 --- a/lib/toaster/toastergui/static/js/libtoaster.js +++ b/lib/toaster/toastergui/static/js/libtoaster.js @@ -114,11 +114,60 @@ var libtoaster = (function (){ }); }; + /* Properties for data can be: + * layerDel (csv) + * layerAdd (csv) + * projectName + * projectVersion + * machineName + */ + function _editProject(url, projectId, data, onSuccess, onFail){ + $.ajax({ + type: "POST", + url: url, + data: data, + headers: { 'X-CSRFToken' : $.cookie('csrftoken')}, + success: function (data) { + if (data.error != "ok") { + console.log(data.error); + if (onFail != undefined) + onFail(data); + } else { + if (onSuccess != undefined) + onSuccess(data); + } + }, + error: function (data) { + console.log("Call failed"); + console.log(data); + } + }); + }; + + function _getLayerDepsForProject(xhrDataTypeaheadUrl, projectId, layerId, onSuccess, onFail){ + /* Check for dependencies not in the current project */ + $.getJSON(xhrDataTypeaheadUrl, + { type: 'layerdeps', 'value': layerId , project_id: projectId }, + function(data) { + if (data.error != "ok") { + console.log(data.error); + if (onFail != undefined) + onFail(data); + } else { + onSuccess(data); + } + }, function() { + console.log("E: Failed to make request"); + }); + }; + return { reload_params : reload_params, startABuild : _startABuild, makeTypeahead : _makeTypeahead, getProjectInfo: _getProjectInfo, + getLayerDepsForProject : _getLayerDepsForProject, + editProject : _editProject, } })(); |