From ed26a06a07a75c8039f2a9b251b350331c7474aa Mon Sep 17 00:00:00 2001 From: Michael Wood Date: Fri, 10 Apr 2015 18:15:03 +0100 Subject: 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 Signed-off-by: Richard Purdie --- bitbake/lib/toaster/toastergui/static/js/libtoaster.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'bitbake/lib/toaster/toastergui/static/js/libtoaster.js') 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 (){ * selectedCB: function to call once an item has been selected one * arg of the item. */ - function _makeTypeahead (jQElement, xhrUrl, xhrParams, selectedCB) { + function _makeTypeahead (jQElement, xhrParams, selectedCB) { jQElement.typeahead({ source: function(query, process){ xhrParams.value = query; - $.getJSON(xhrUrl, this.options.xhrParams, function(data){ + $.getJSON(libtoaster.ctx.xhrDataTypeaheadUrl, this.options.xhrParams, function(data){ if (data.error !== "ok") { console.log("Error getting data from server "+data.error); return; @@ -41,7 +41,7 @@ var libtoaster = (function (){ return $('').text(item.name).get(0); }, sorter: function (items) { return items; }, - xhrUrl: xhrUrl, + xhrUrl: libtoaster.ctx.xhrDataTypeaheadUrl, xhrParams: xhrParams, }); @@ -147,10 +147,10 @@ var libtoaster = (function (){ * projectVersion * machineName */ - function _editProject(url, projectId, data, onSuccess, onFail){ + function _editCurrentProject(data, onSuccess, onFail){ $.ajax({ type: "POST", - url: url, + url: libtoaster.ctx.xhrProjectEditUrl, data: data, headers: { 'X-CSRFToken' : $.cookie('csrftoken')}, success: function (data) { @@ -170,9 +170,9 @@ var libtoaster = (function (){ }); } - function _getLayerDepsForProject(xhrDataTypeaheadUrl, projectId, layerId, onSuccess, onFail){ + function _getLayerDepsForProject(projectId, layerId, onSuccess, onFail){ /* Check for dependencies not in the current project */ - $.getJSON(xhrDataTypeaheadUrl, + $.getJSON(libtoaster.ctx.xhrDataTypeaheadUrl, { type: 'layerdeps', 'value': layerId , project_id: projectId }, function(data) { if (data.error != "ok") { @@ -227,7 +227,7 @@ var libtoaster = (function (){ makeTypeahead : _makeTypeahead, getProjectInfo: _getProjectInfo, getLayerDepsForProject : _getLayerDepsForProject, - editProject : _editProject, + editCurrentProject : _editCurrentProject, debug: false, parseUrlParams : _parseUrlParams, dumpsUrlParams : _dumpsUrlParams, -- cgit v1.2.3-54-g00ecf