diff options
author | Michael Wood <michael.g.wood@intel.com> | 2015-04-10 18:15:03 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-05-08 17:42:05 +0100 |
commit | ed26a06a07a75c8039f2a9b251b350331c7474aa (patch) | |
tree | ebb2d88d75b51a856322c0a26ab89570a9954276 /bitbake/lib/toaster/toastergui/static/js/libtoaster.js | |
parent | 4b59ba1bbb61fe60f500ad742a6515227b22397d (diff) | |
download | poky-ed26a06a07a75c8039f2a9b251b350331c7474aa.tar.gz |
bitbake: toaster: Move project context variables to common scope
We have a bunch of context data which are used in multiple pages so it
makes more sense to have this in a single place libtoaster.ctx that's
accessible from each page rather than request it from every page.
(Bitbake rev: 4ef2774a2f683929c700550a9acc7b8f6074195b)
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/static/js/libtoaster.js')
-rw-r--r-- | bitbake/lib/toaster/toastergui/static/js/libtoaster.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js index ae9e4556a1..9257f735db 100644 --- a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js +++ b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js | |||
@@ -14,12 +14,12 @@ var libtoaster = (function (){ | |||
14 | * selectedCB: function to call once an item has been selected one | 14 | * selectedCB: function to call once an item has been selected one |
15 | * arg of the item. | 15 | * arg of the item. |
16 | */ | 16 | */ |
17 | function _makeTypeahead (jQElement, xhrUrl, xhrParams, selectedCB) { | 17 | function _makeTypeahead (jQElement, xhrParams, selectedCB) { |
18 | 18 | ||
19 | jQElement.typeahead({ | 19 | jQElement.typeahead({ |
20 | source: function(query, process){ | 20 | source: function(query, process){ |
21 | xhrParams.value = query; | 21 | xhrParams.value = query; |
22 | $.getJSON(xhrUrl, this.options.xhrParams, function(data){ | 22 | $.getJSON(libtoaster.ctx.xhrDataTypeaheadUrl, this.options.xhrParams, function(data){ |
23 | if (data.error !== "ok") { | 23 | if (data.error !== "ok") { |
24 | console.log("Error getting data from server "+data.error); | 24 | console.log("Error getting data from server "+data.error); |
25 | return; | 25 | return; |
@@ -41,7 +41,7 @@ var libtoaster = (function (){ | |||
41 | return $('<span></span>').text(item.name).get(0); | 41 | return $('<span></span>').text(item.name).get(0); |
42 | }, | 42 | }, |
43 | sorter: function (items) { return items; }, | 43 | sorter: function (items) { return items; }, |
44 | xhrUrl: xhrUrl, | 44 | xhrUrl: libtoaster.ctx.xhrDataTypeaheadUrl, |
45 | xhrParams: xhrParams, | 45 | xhrParams: xhrParams, |
46 | }); | 46 | }); |
47 | 47 | ||
@@ -147,10 +147,10 @@ var libtoaster = (function (){ | |||
147 | * projectVersion | 147 | * projectVersion |
148 | * machineName | 148 | * machineName |
149 | */ | 149 | */ |
150 | function _editProject(url, projectId, data, onSuccess, onFail){ | 150 | function _editCurrentProject(data, onSuccess, onFail){ |
151 | $.ajax({ | 151 | $.ajax({ |
152 | type: "POST", | 152 | type: "POST", |
153 | url: url, | 153 | url: libtoaster.ctx.xhrProjectEditUrl, |
154 | data: data, | 154 | data: data, |
155 | headers: { 'X-CSRFToken' : $.cookie('csrftoken')}, | 155 | headers: { 'X-CSRFToken' : $.cookie('csrftoken')}, |
156 | success: function (data) { | 156 | success: function (data) { |
@@ -170,9 +170,9 @@ var libtoaster = (function (){ | |||
170 | }); | 170 | }); |
171 | } | 171 | } |
172 | 172 | ||
173 | function _getLayerDepsForProject(xhrDataTypeaheadUrl, projectId, layerId, onSuccess, onFail){ | 173 | function _getLayerDepsForProject(projectId, layerId, onSuccess, onFail){ |
174 | /* Check for dependencies not in the current project */ | 174 | /* Check for dependencies not in the current project */ |
175 | $.getJSON(xhrDataTypeaheadUrl, | 175 | $.getJSON(libtoaster.ctx.xhrDataTypeaheadUrl, |
176 | { type: 'layerdeps', 'value': layerId , project_id: projectId }, | 176 | { type: 'layerdeps', 'value': layerId , project_id: projectId }, |
177 | function(data) { | 177 | function(data) { |
178 | if (data.error != "ok") { | 178 | if (data.error != "ok") { |
@@ -227,7 +227,7 @@ var libtoaster = (function (){ | |||
227 | makeTypeahead : _makeTypeahead, | 227 | makeTypeahead : _makeTypeahead, |
228 | getProjectInfo: _getProjectInfo, | 228 | getProjectInfo: _getProjectInfo, |
229 | getLayerDepsForProject : _getLayerDepsForProject, | 229 | getLayerDepsForProject : _getLayerDepsForProject, |
230 | editProject : _editProject, | 230 | editCurrentProject : _editCurrentProject, |
231 | debug: false, | 231 | debug: false, |
232 | parseUrlParams : _parseUrlParams, | 232 | parseUrlParams : _parseUrlParams, |
233 | dumpsUrlParams : _dumpsUrlParams, | 233 | dumpsUrlParams : _dumpsUrlParams, |