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>
This commit is contained in:
Michael Wood
2015-04-10 18:15:03 +01:00
committed by Richard Purdie
parent 4b59ba1bbb
commit ed26a06a07
10 changed files with 63 additions and 72 deletions

View File

@@ -18,7 +18,7 @@ function importLayerPageInit (ctx) {
$("#new-project-button").hide();
libtoaster.makeTypeahead(layerDepInput, ctx.xhrDataTypeaheadUrl, { type : "layers", project_id: ctx.projectId, include_added: "true" }, function(item){
libtoaster.makeTypeahead(layerDepInput, { type : "layers", project_id: libtoaster.ctx.projectId, include_added: "true" }, function(item){
currentLayerDepSelection = item;
layerDepBtn.removeAttr("disabled");
@@ -28,7 +28,7 @@ function importLayerPageInit (ctx) {
/* We automatically add "openembedded-core" layer for convenience as a
* dependency as pretty much all layers depend on this one
*/
$.getJSON(ctx.xhrDataTypeaheadUrl, { type : "layers", project_id: ctx.projectId, include_added: "true" , value: "openembedded-core" }, function(layer) {
$.getJSON(libtoaster.ctx.xhrDataTypeaheadUrl, { type : "layers", project_id: libtoaster.ctx.projectId, include_added: "true" , value: "openembedded-core" }, function(layer) {
if (layer.list.length == 1) {
currentLayerDepSelection = layer.list[0];
layerDepBtn.click();
@@ -63,7 +63,7 @@ function importLayerPageInit (ctx) {
$("#layer-deps-list").append(newLayerDep);
libtoaster.getLayerDepsForProject(ctx.xhrDataTypeaheadUrl, ctx.projectId, currentLayerDepSelection.id, function (data){
libtoaster.getLayerDepsForProject(libtoaster.ctx.projectId, currentLayerDepSelection.id, function (data){
/* These are the dependencies of the layer added as a dependency */
if (data.list.length > 0) {
currentLayerDepSelection.url = ctx.layerDetailsUrl+currentLayerDepSelection.id;
@@ -137,7 +137,7 @@ function importLayerPageInit (ctx) {
vcs_url: vcsURLInput.val(),
git_ref: gitRefInput.val(),
dir_path: $("#layer-subdir").val(),
project_id: ctx.projectId,
project_id: libtoaster.ctx.projectId,
layer_deps: layerDepsCsv,
};
@@ -152,7 +152,7 @@ function importLayerPageInit (ctx) {
} else {
/* Success layer import now go to the project page */
$.cookie('layer-imported-alert', JSON.stringify(data), { path: '/'});
window.location.replace(ctx.projectPageUrl+'#/layerimported');
window.location.replace(libtoaster.ctx.projectPageUrl+'#/layerimported');
}
},
error: function (data) {
@@ -211,7 +211,7 @@ function importLayerPageInit (ctx) {
var name = $(this).val();
/* Check if the layer name exists */
$.getJSON(ctx.xhrDataTypeaheadUrl, { type : "layers", project_id: ctx.projectId, include_added: "true" , value: name }, function(layer) {
$.getJSON(libtoaster.ctx.xhrDataTypeaheadUrl, { type : "layers", project_id: libtoaster.ctx.projectId, include_added: "true" , value: name }, function(layer) {
if (layer.list.length > 0) {
for (var i in layer.list){
if (layer.list[i].name == name) {