diff options
| -rw-r--r-- | bitbake/lib/toaster/toastergui/static/js/libtoaster.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js index b691a3bee8..15815b333e 100644 --- a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js +++ b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js | |||
| @@ -114,11 +114,60 @@ var libtoaster = (function (){ | |||
| 114 | }); | 114 | }); |
| 115 | }; | 115 | }; |
| 116 | 116 | ||
| 117 | /* Properties for data can be: | ||
| 118 | * layerDel (csv) | ||
| 119 | * layerAdd (csv) | ||
| 120 | * projectName | ||
| 121 | * projectVersion | ||
| 122 | * machineName | ||
| 123 | */ | ||
| 124 | function _editProject(url, projectId, data, onSuccess, onFail){ | ||
| 125 | $.ajax({ | ||
| 126 | type: "POST", | ||
| 127 | url: url, | ||
| 128 | data: data, | ||
| 129 | headers: { 'X-CSRFToken' : $.cookie('csrftoken')}, | ||
| 130 | success: function (data) { | ||
| 131 | if (data.error != "ok") { | ||
| 132 | console.log(data.error); | ||
| 133 | if (onFail != undefined) | ||
| 134 | onFail(data); | ||
| 135 | } else { | ||
| 136 | if (onSuccess != undefined) | ||
| 137 | onSuccess(data); | ||
| 138 | } | ||
| 139 | }, | ||
| 140 | error: function (data) { | ||
| 141 | console.log("Call failed"); | ||
| 142 | console.log(data); | ||
| 143 | } | ||
| 144 | }); | ||
| 145 | }; | ||
| 146 | |||
| 147 | function _getLayerDepsForProject(xhrDataTypeaheadUrl, projectId, layerId, onSuccess, onFail){ | ||
| 148 | /* Check for dependencies not in the current project */ | ||
| 149 | $.getJSON(xhrDataTypeaheadUrl, | ||
| 150 | { type: 'layerdeps', 'value': layerId , project_id: projectId }, | ||
| 151 | function(data) { | ||
| 152 | if (data.error != "ok") { | ||
| 153 | console.log(data.error); | ||
| 154 | if (onFail != undefined) | ||
| 155 | onFail(data); | ||
| 156 | } else { | ||
| 157 | onSuccess(data); | ||
| 158 | } | ||
| 159 | }, function() { | ||
| 160 | console.log("E: Failed to make request"); | ||
| 161 | }); | ||
| 162 | }; | ||
| 163 | |||
| 117 | return { | 164 | return { |
| 118 | reload_params : reload_params, | 165 | reload_params : reload_params, |
| 119 | startABuild : _startABuild, | 166 | startABuild : _startABuild, |
| 120 | makeTypeahead : _makeTypeahead, | 167 | makeTypeahead : _makeTypeahead, |
| 121 | getProjectInfo: _getProjectInfo, | 168 | getProjectInfo: _getProjectInfo, |
| 169 | getLayerDepsForProject : _getLayerDepsForProject, | ||
| 170 | editProject : _editProject, | ||
| 122 | } | 171 | } |
| 123 | })(); | 172 | })(); |
| 124 | 173 | ||
