diff --git a/bitbake/lib/toaster/toastergui/static/js/importlayer.js b/bitbake/lib/toaster/toastergui/static/js/importlayer.js index e2bc1ab607..15830dded5 100644 --- a/bitbake/lib/toaster/toastergui/static/js/importlayer.js +++ b/bitbake/lib/toaster/toastergui/static/js/importlayer.js @@ -78,8 +78,14 @@ function importLayerPageInit (ctx) { }); importAndAddBtn.click(function(){ + /* This is a list of the names from layerDeps for the layer deps + * modal dialog body + */ + var depNames = []; + /* arrray of all layer dep ids includes parent and child deps */ var allDeps = []; + /* temporary object to use to do a reduce on the dependencies for each * layer dependency added */ @@ -96,6 +102,7 @@ function importLayerPageInit (ctx) { depDeps[layer.id] = layer; } } + depNames.push(layerDeps[key].name); allDeps.push(layerDeps[key].id); } @@ -106,10 +113,14 @@ function importLayerPageInit (ctx) { if (depDepsArray.length > 0) { var layer = { name: layerNameInput.val(), url: "#", id: -1 }; - show_layer_deps_modal(ctx.projectId, layer, depDepsArray, function(selected){ + var title = "Layer"; + var body = ""+layer.name+"'s dependencies ("+ + depNames.join(", ")+") require some layers that are not added to your project. Select the ones you want to add:
"; + + show_layer_deps_modal(ctx.projectId, layer, depDepsArray, title, body, false, function(selected){ /* Add the accepted dependencies to the allDeps array */ if (selected.length > 0){ - allDeps.concat (selected); + allDeps = allDeps.concat (selected); } import_and_add (); }); @@ -141,8 +152,10 @@ function importLayerPageInit (ctx) { show_error_message(data, layerData); console.log(data.error); } else { + layerData.layersAdded = data.layers_added; /* Success layer import now go to the project page */ - window.location.replace(ctx.projectPageUrl+'#/layerimported='+layerData.name); + $.cookie('layer-imported-alert', JSON.stringify(layerData), { path: '/'}); + window.location.replace(ctx.projectPageUrl+'#/layerimported'); } }, error: function (data) { diff --git a/bitbake/lib/toaster/toastergui/static/js/projectapp.js b/bitbake/lib/toaster/toastergui/static/js/projectapp.js index 8e3499a94c..94c24f4a56 100644 --- a/bitbake/lib/toaster/toastergui/static/js/projectapp.js +++ b/bitbake/lib/toaster/toastergui/static/js/projectapp.js @@ -128,7 +128,7 @@ projectApp.filter('timediff', function() { // main controller for the project page -projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $location, $cookies, $q, $sce, $anchorScroll, $animate, $sanitize) { +projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $location, $cookies, $cookieStore, $q, $sce, $anchorScroll, $animate, $sanitize) { $scope.getSuggestions = function(type, currentValue) { var deffered = $q.defer(); @@ -572,9 +572,28 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc }); _cmdExecuteWithParam("/layerimported", function (layer) { - $scope.displayAlert($scope.zone2alerts, - "You have imported " + layer + - " and added it to your project.", "alert-success"); + var imported = $cookieStore.get("layer-imported-alert"); + var text; + + if (!imported) + return; + + if (imported.layersAdded.length == 0) { + text = "You have imported "+imported.name+ + " and added it to your project."; + } else { + text = "You have imported "+imported.name+ + " and added "+imported.layersAdded.length+ + " layers to your project. "+ + imported.layersAdded.join(", ")+""; + } + + $scope.displayAlert($scope.zone2alerts, text, "alert-info"); + + // This doesn't work + $cookieStore.remove("layer-imported-alert"); + //use jquery plugin instead + $.removeCookie("layer-imported-alert", { path: "/"}); }); _cmdExecuteWithParam("/targetbuild=", function (targets) { diff --git a/bitbake/lib/toaster/toastergui/templates/layers_dep_modal.html b/bitbake/lib/toaster/toastergui/templates/layers_dep_modal.html index 821bbda296..b03fd0b218 100644 --- a/bitbake/lib/toaster/toastergui/templates/layers_dep_modal.html +++ b/bitbake/lib/toaster/toastergui/templates/layers_dep_modal.html @@ -3,10 +3,10 @@