summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/toaster/toastergui')
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/importlayer.js3
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/projectapp.js29
-rw-r--r--bitbake/lib/toaster/toastergui/templates/project.html3
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py4
4 files changed, 26 insertions, 13 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/importlayer.js b/bitbake/lib/toaster/toastergui/static/js/importlayer.js
index 34dbcd9ed7..5748efd8ce 100644
--- a/bitbake/lib/toaster/toastergui/static/js/importlayer.js
+++ b/bitbake/lib/toaster/toastergui/static/js/importlayer.js
@@ -152,9 +152,8 @@ function importLayerPageInit (ctx) {
152 show_error_message(data, layerData); 152 show_error_message(data, layerData);
153 console.log(data.error); 153 console.log(data.error);
154 } else { 154 } else {
155 layerData.layersAdded = data.layers_added;
156 /* Success layer import now go to the project page */ 155 /* Success layer import now go to the project page */
157 $.cookie('layer-imported-alert', JSON.stringify(layerData), { path: '/'}); 156 $.cookie('layer-imported-alert', JSON.stringify(data), { path: '/'});
158 window.location.replace(ctx.projectPageUrl+'#/layerimported'); 157 window.location.replace(ctx.projectPageUrl+'#/layerimported');
159 } 158 }
160 }, 159 },
diff --git a/bitbake/lib/toaster/toastergui/static/js/projectapp.js b/bitbake/lib/toaster/toastergui/static/js/projectapp.js
index 94c24f4a56..741038df27 100644
--- a/bitbake/lib/toaster/toastergui/static/js/projectapp.js
+++ b/bitbake/lib/toaster/toastergui/static/js/projectapp.js
@@ -578,18 +578,31 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc
578 if (!imported) 578 if (!imported)
579 return; 579 return;
580 580
581 if (imported.layersAdded.length == 0) { 581 if (imported.deps_added.length == 0) {
582 text = "You have imported <strong>"+imported.name+ 582 text = "You have imported <strong><a href=\""+$scope.urls.layer+
583 "</strong> and added it to your project."; 583 imported.imported_layer.id+"\">"+imported.imported_layer.name+
584 "</a></strong> and added it to your project.";
584 } else { 585 } else {
585 text = "You have imported <strong>"+imported.name+ 586 var links = "<a href=\""+$scope.urls.layer+
586 "</strong> and added <strong>"+imported.layersAdded.length+ 587 imported.imported_layer.id+"\">"+imported.imported_layer.name+
587 "</strong> layers to your project. <strong>"+ 588 "</a>, ";
588 imported.layersAdded.join(", ")+"</strong>"; 589
590 imported.deps_added.map (function(item, index){
591 links +="<a href=\""+$scope.urls.layer+item.id+"\" >"+item.name+
592 "</a>";
593 /*If we're at the last element we don't want the trailing comma */
594 if (imported.deps_added[index+1] != undefined)
595 links += ", ";
596 });
597
598 /* Length + 1 here to do deps + the imported layer */
599 text = "You have imported <strong><a href=\""+$scope.urls.layer+
600 imported.imported_layer.id+"\">"+imported.imported_layer.name+
601 "</a></strong> and added <strong>"+(imported.deps_added.length+1)+
602 "</strong> layers to your project. <strong>"+links+"</strong>";
589 } 603 }
590 604
591 $scope.displayAlert($scope.zone2alerts, text, "alert-info"); 605 $scope.displayAlert($scope.zone2alerts, text, "alert-info");
592
593 // This doesn't work 606 // This doesn't work
594 $cookieStore.remove("layer-imported-alert"); 607 $cookieStore.remove("layer-imported-alert");
595 //use jquery plugin instead 608 //use jquery plugin instead
diff --git a/bitbake/lib/toaster/toastergui/templates/project.html b/bitbake/lib/toaster/toastergui/templates/project.html
index 113e382d45..2979db74ed 100644
--- a/bitbake/lib/toaster/toastergui/templates/project.html
+++ b/bitbake/lib/toaster/toastergui/templates/project.html
@@ -382,7 +382,8 @@ angular.element(document).ready(function() {
382 scope.urls.xhr_datatypeahead = "{% url 'xhr_datatypeahead' %}"; 382 scope.urls.xhr_datatypeahead = "{% url 'xhr_datatypeahead' %}";
383 scope.urls.layers = "{% url 'layers' %}"; 383 scope.urls.layers = "{% url 'layers' %}";
384 scope.urls.targets = "{% url 'targets' %}"; 384 scope.urls.targets = "{% url 'targets' %}";
385 scope.urls.importlayer = "{% url 'importlayer'%}" 385 scope.urls.importlayer = "{% url 'importlayer'%}";
386 scope.urls.layer = "{% url 'layerdetails' %}";
386 scope.project = {{prj|json}}; 387 scope.project = {{prj|json}};
387 scope.builds = {{builds|json}}; 388 scope.builds = {{builds|json}};
388 scope.layers = {{layers|json}}; 389 scope.layers = {{layers|json}};
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index dd430805b1..679c1e9430 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -2322,7 +2322,7 @@ if toastermain.settings.MANAGED:
2322 continue 2322 continue
2323 2323
2324 if prj_layer_created: 2324 if prj_layer_created:
2325 layers_added.append(Layer.objects.get(id=layer_dep_obj.layer_id).name) 2325 layers_added.append({'id': layer_dep_obj.id, 'name': Layer.objects.get(id=layer_dep_obj.layer_id).name})
2326 2326
2327 2327
2328 # If an old layer version exists in our project then remove it 2328 # If an old layer version exists in our project then remove it
@@ -2342,7 +2342,7 @@ if toastermain.settings.MANAGED:
2342 return HttpResponse(jsonfilter({"error": "Uncaught error: Could not create layer version"}), content_type = "application/json") 2342 return HttpResponse(jsonfilter({"error": "Uncaught error: Could not create layer version"}), content_type = "application/json")
2343 2343
2344 2344
2345 return HttpResponse(jsonfilter({"error": "ok", "layers_added": layers_added}), content_type = "application/json") 2345 return HttpResponse(jsonfilter({"error": "ok", "imported_layer" : { "name" : layer.name, "id": layer_version.id }, "deps_added": layers_added }), content_type = "application/json")
2346 2346
2347 2347
2348 2348