diff options
10 files changed, 73 insertions, 47 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/importlayer.js b/bitbake/lib/toaster/toastergui/static/js/importlayer.js index e1fc5c5187..e9d7ae8ef2 100644 --- a/bitbake/lib/toaster/toastergui/static/js/importlayer.js +++ b/bitbake/lib/toaster/toastergui/static/js/importlayer.js | |||
| @@ -48,7 +48,7 @@ function importLayerPageInit (ctx) { | |||
| 48 | newLayerDep.children("span").tooltip(); | 48 | newLayerDep.children("span").tooltip(); |
| 49 | 49 | ||
| 50 | var link = newLayerDep.children("a"); | 50 | var link = newLayerDep.children("a"); |
| 51 | link.attr("href", ctx.layerDetailsUrl+String(currentLayerDepSelection.id)); | 51 | link.attr("href", currentLayerDepSelection.layerDetailsUrl); |
| 52 | link.text(currentLayerDepSelection.name); | 52 | link.text(currentLayerDepSelection.name); |
| 53 | link.tooltip({title: currentLayerDepSelection.tooltip, placement: "right"}); | 53 | link.tooltip({title: currentLayerDepSelection.tooltip, placement: "right"}); |
| 54 | 54 | ||
| @@ -63,11 +63,11 @@ function importLayerPageInit (ctx) { | |||
| 63 | 63 | ||
| 64 | $("#layer-deps-list").append(newLayerDep); | 64 | $("#layer-deps-list").append(newLayerDep); |
| 65 | 65 | ||
| 66 | libtoaster.getLayerDepsForProject(libtoaster.ctx.projectId, currentLayerDepSelection.id, function (data){ | 66 | libtoaster.getLayerDepsForProject(currentLayerDepSelection.layerDetailsUrl, function (data){ |
| 67 | /* These are the dependencies of the layer added as a dependency */ | 67 | /* These are the dependencies of the layer added as a dependency */ |
| 68 | if (data.list.length > 0) { | 68 | if (data.list.length > 0) { |
| 69 | currentLayerDepSelection.url = ctx.layerDetailsUrl+currentLayerDepSelection.id; | 69 | currentLayerDepSelection.url = currentLayerDepSelection.layerDetailsUrl; |
| 70 | layerDeps[currentLayerDepSelection.id].deps = data.list | 70 | layerDeps[currentLayerDepSelection.id].deps = data.list; |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | /* Clear the current selection */ | 73 | /* Clear the current selection */ |
diff --git a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js index ab781829cd..0accd971d4 100644 --- a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js +++ b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js | |||
| @@ -65,7 +65,7 @@ function layerDetailsPageInit (ctx) { | |||
| 65 | newLayerDep.children("span").tooltip(); | 65 | newLayerDep.children("span").tooltip(); |
| 66 | 66 | ||
| 67 | var link = newLayerDep.children("a"); | 67 | var link = newLayerDep.children("a"); |
| 68 | link.attr("href", ctx.layerDetailsUrl+String(currentLayerDepSelection.id)); | 68 | link.attr("href", currentLayerDepSelection.layerDetailsUrl); |
| 69 | link.text(currentLayerDepSelection.name); | 69 | link.text(currentLayerDepSelection.name); |
| 70 | link.tooltip({title: currentLayerDepSelection.tooltip, placement: "right"}); | 70 | link.tooltip({title: currentLayerDepSelection.tooltip, placement: "right"}); |
| 71 | 71 | ||
diff --git a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js index 2a9a790693..b1038cf618 100644 --- a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js +++ b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js | |||
| @@ -170,10 +170,10 @@ var libtoaster = (function (){ | |||
| 170 | }); | 170 | }); |
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | function _getLayerDepsForProject(projectId, layerId, onSuccess, onFail){ | 173 | function _getLayerDepsForProject(url, onSuccess, onFail){ |
| 174 | /* Check for dependencies not in the current project */ | 174 | /* Check for dependencies not in the current project */ |
| 175 | $.getJSON(libtoaster.ctx.projectLayersUrl, | 175 | $.getJSON(url, |
| 176 | { format: 'json', search: layerId }, | 176 | { format: 'json' }, |
| 177 | function(data) { | 177 | function(data) { |
| 178 | if (data.error != "ok") { | 178 | if (data.error != "ok") { |
| 179 | console.log(data.error); | 179 | console.log(data.error); |
| @@ -225,8 +225,7 @@ var libtoaster = (function (){ | |||
| 225 | function _addRmLayer(layerObj, add, doneCb){ | 225 | function _addRmLayer(layerObj, add, doneCb){ |
| 226 | if (add === true) { | 226 | if (add === true) { |
| 227 | /* If adding get the deps for this layer */ | 227 | /* If adding get the deps for this layer */ |
| 228 | libtoaster.getLayerDepsForProject(libtoaster.ctx.projectId, | 228 | libtoaster.getLayerDepsForProject(layerObj.url, |
| 229 | layerObj.id, | ||
| 230 | function (layers) { | 229 | function (layers) { |
| 231 | 230 | ||
| 232 | /* got result for dependencies */ | 231 | /* got result for dependencies */ |
diff --git a/bitbake/lib/toaster/toastergui/static/js/projectapp.js b/bitbake/lib/toaster/toastergui/static/js/projectapp.js index 36c942fa29..a915278444 100644 --- a/bitbake/lib/toaster/toastergui/static/js/projectapp.js +++ b/bitbake/lib/toaster/toastergui/static/js/projectapp.js | |||
| @@ -16,7 +16,9 @@ | |||
| 16 | // with this program; if not, write to the Free Software Foundation, Inc., | 16 | // with this program; if not, write to the Free Software Foundation, Inc., |
| 17 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 17 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 | 18 | ||
| 19 | angular_formpost = function($httpProvider) { | 19 | 'use strict'; |
| 20 | |||
| 21 | var angular_formpost = function($httpProvider) { | ||
| 20 | // Use x-www-form-urlencoded Content-Type | 22 | // Use x-www-form-urlencoded Content-Type |
| 21 | // By Ezekiel Victor, http://victorblog.com/2012/12/20/make-angularjs-http-service-behave-like-jquery-ajax/, no license, with attribution | 23 | // By Ezekiel Victor, http://victorblog.com/2012/12/20/make-angularjs-http-service-behave-like-jquery-ajax/, no license, with attribution |
| 22 | $httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8'; | 24 | $httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8'; |
| @@ -127,10 +129,10 @@ projectApp.filter('timediff', function() { | |||
| 127 | if (parseInt(j) < 10) {return "0" + j;} | 129 | if (parseInt(j) < 10) {return "0" + j;} |
| 128 | return j; | 130 | return j; |
| 129 | } | 131 | } |
| 130 | seconds = parseInt(input); | 132 | var seconds = parseInt(input); |
| 131 | minutes = Math.floor(seconds / 60); | 133 | var minutes = Math.floor(seconds / 60); |
| 132 | seconds = seconds - minutes * 60; | 134 | seconds = seconds - minutes * 60; |
| 133 | hours = Math.floor(seconds / 3600); | 135 | var hours = Math.floor(seconds / 3600); |
| 134 | seconds = seconds - hours * 3600; | 136 | seconds = seconds - hours * 3600; |
| 135 | return pad(hours) + ":" + pad(minutes) + ":" + pad(seconds); | 137 | return pad(hours) + ":" + pad(minutes) + ":" + pad(seconds); |
| 136 | }; | 138 | }; |
| @@ -250,6 +252,31 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc | |||
| 250 | } | 252 | } |
| 251 | var deffered = $q.defer(); | 253 | var deffered = $q.defer(); |
| 252 | 254 | ||
| 255 | /* we only talk in JSON to the server */ | ||
| 256 | if (callparams.method == 'GET') { | ||
| 257 | if (callparams.data === undefined) { | ||
| 258 | callparams.data = {}; | ||
| 259 | } | ||
| 260 | callparams.data.format = "json"; | ||
| 261 | } else { | ||
| 262 | if (callparams.url.indexOf("?") > -1) { | ||
| 263 | callparams.url = callparams.url.split("?").map(function (element, index) { | ||
| 264 | if (index == 1) { | ||
| 265 | var elements = []; | ||
| 266 | if (element.indexOf("&")>-1) { | ||
| 267 | elements = element.split("&"); | ||
| 268 | } | ||
| 269 | elements.push("format=json"); | ||
| 270 | element = elements.join("&"); | ||
| 271 | } | ||
| 272 | return element; | ||
| 273 | }).join("?"); | ||
| 274 | } else { | ||
| 275 | callparams.url += "?format=json"; | ||
| 276 | } | ||
| 277 | } | ||
| 278 | |||
| 279 | |||
| 253 | if (undefined === callparams.headers) { callparams.headers = {}; } | 280 | if (undefined === callparams.headers) { callparams.headers = {}; } |
| 254 | callparams.headers['X-CSRFToken'] = $cookies.csrftoken; | 281 | callparams.headers['X-CSRFToken'] = $cookies.csrftoken; |
| 255 | 282 | ||
| @@ -476,8 +503,9 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc | |||
| 476 | }; | 503 | }; |
| 477 | 504 | ||
| 478 | 505 | ||
| 479 | $scope.onLayerSelect = function (item) { | 506 | $scope.onLayerSelect = function (item, model, label) { |
| 480 | $scope.layerToAdd = item; | 507 | $scope.layerToAdd = item; |
| 508 | $scope.layerAddName = item.layer__name; | ||
| 481 | }; | 509 | }; |
| 482 | 510 | ||
| 483 | $scope.machineSelect = function (machineName) { | 511 | $scope.machineSelect = function (machineName) { |
| @@ -501,20 +529,22 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc | |||
| 501 | 529 | ||
| 502 | $scope.layerAdd = function() { | 530 | $scope.layerAdd = function() { |
| 503 | 531 | ||
| 504 | $http({method:"GET", url: $scope.layerToAdd.layerdict.layerdetailurl, params : {}}) | 532 | $http({method:"GET", url: $scope.layerToAdd.layerDetailsUrl, params : {format: "json"}}) |
| 505 | .success(function (_data) { | 533 | .success(function (_data) { |
| 506 | if (_data.error != "ok") { | 534 | if (_data.error != "ok") { |
| 507 | console.warn(_data.error); | 535 | console.warn(_data.error); |
| 508 | } else { | 536 | } else { |
| 509 | if (_data.list.length > 0) { | 537 | console.log("got layer deps", _data.layerdeps.list); |
| 538 | if (_data.layerdeps.list.length > 0) { | ||
| 510 | // activate modal | 539 | // activate modal |
| 540 | console.log("listing modals"); | ||
| 511 | var modalInstance = $modal.open({ | 541 | var modalInstance = $modal.open({ |
| 512 | templateUrl: 'dependencies_modal', | 542 | templateUrl: 'dependencies_modal', |
| 513 | controller: function ($scope, $modalInstance, items, layerAddName) { | 543 | controller: function ($scope, $modalInstance, items, layerAddName) { |
| 514 | $scope.items = items; | 544 | $scope.items = items; |
| 515 | $scope.layerAddName = layerAddName; | 545 | $scope.layerAddName = layerAddName; |
| 516 | $scope.selectedItems = (function () { | 546 | $scope.selectedItems = (function () { |
| 517 | s = {}; | 547 | var s = {}; |
| 518 | for (var i = 0; i < items.length; i++) | 548 | for (var i = 0; i < items.length; i++) |
| 519 | { s[items[i].id] = true; } | 549 | { s[items[i].id] = true; } |
| 520 | return s; | 550 | return s; |
| @@ -535,16 +565,18 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc | |||
| 535 | }, | 565 | }, |
| 536 | resolve: { | 566 | resolve: { |
| 537 | items: function () { | 567 | items: function () { |
| 538 | return _data.list; | 568 | return _data.layerdeps.list; |
| 539 | }, | 569 | }, |
| 540 | layerAddName: function () { | 570 | layerAddName: function () { |
| 541 | return $scope.layerAddName; | 571 | return $scope.layerAddName; |
| 542 | }, | 572 | }, |
| 543 | } | 573 | } |
| 544 | }); | 574 | }); |
| 575 | console.log("built modal instance", modalInstance); | ||
| 545 | 576 | ||
| 546 | modalInstance.result.then(function (selectedArray) { | 577 | modalInstance.result.then(function (selectedArray) { |
| 547 | selectedArray.push($scope.layerToAdd.layerversion.id); | 578 | console.log("layer to add", $scope.layerToAdd) |
| 579 | selectedArray.push($scope.layerToAdd.id); | ||
| 548 | console.warn("TRC6: selected", selectedArray); | 580 | console.warn("TRC6: selected", selectedArray); |
| 549 | 581 | ||
| 550 | $scope._makeXHRCall({ | 582 | $scope._makeXHRCall({ |
| @@ -563,7 +595,7 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc | |||
| 563 | $scope._makeXHRCall({ | 595 | $scope._makeXHRCall({ |
| 564 | method: "POST", url: $scope.urls.xhr_edit, | 596 | method: "POST", url: $scope.urls.xhr_edit, |
| 565 | data: { | 597 | data: { |
| 566 | layerAdd: $scope.layerToAdd.layerversion.id, | 598 | layerAdd: $scope.layerToAdd.id, |
| 567 | } | 599 | } |
| 568 | }).then(function () { | 600 | }).then(function () { |
| 569 | $scope.layerAddName = undefined; | 601 | $scope.layerAddName = undefined; |
| @@ -772,8 +804,7 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc | |||
| 772 | return; | 804 | return; |
| 773 | 805 | ||
| 774 | if (imported.deps_added.length === 0) { | 806 | if (imported.deps_added.length === 0) { |
| 775 | text = "You have imported <strong><a href=\""+$scope.urls.layer+ | 807 | text = "You have imported <strong><a href=\""+imported.imported_layer.layerDetailsUrl+"\">"+imported.imported_layer.name+ |
| 776 | imported.imported_layer.id+"\">"+imported.imported_layer.name+ | ||
| 777 | "</a></strong> and added it to your project."; | 808 | "</a></strong> and added it to your project."; |
| 778 | } else { | 809 | } else { |
| 779 | var links = "<a href=\""+$scope.urls.layer+ | 810 | var links = "<a href=\""+$scope.urls.layer+ |
| @@ -781,7 +812,7 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc | |||
| 781 | "</a>, "; | 812 | "</a>, "; |
| 782 | 813 | ||
| 783 | imported.deps_added.map (function(item, index){ | 814 | imported.deps_added.map (function(item, index){ |
| 784 | links +="<a href=\""+$scope.urls.layer+item.id+"\" >"+item.name+ | 815 | links +="<a href=\""+item.layerDetailsUrl+"\" >"+item.name+ |
| 785 | "</a>"; | 816 | "</a>"; |
| 786 | /*If we're at the last element we don't want the trailing comma */ | 817 | /*If we're at the last element we don't want the trailing comma */ |
| 787 | if (imported.deps_added[index+1] !== undefined) | 818 | if (imported.deps_added[index+1] !== undefined) |
| @@ -832,7 +863,7 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc | |||
| 832 | if (zone.maxid === undefined) { zone.maxid = 0; } | 863 | if (zone.maxid === undefined) { zone.maxid = 0; } |
| 833 | var crtid = zone.maxid ++; | 864 | var crtid = zone.maxid ++; |
| 834 | angular.forEach(zone, function (o) { o.close(); }); | 865 | angular.forEach(zone, function (o) { o.close(); }); |
| 835 | o = { | 866 | var o = { |
| 836 | id: crtid, text: text, type: type, | 867 | id: crtid, text: text, type: type, |
| 837 | close: function() { | 868 | close: function() { |
| 838 | zone.splice((function(id) { | 869 | zone.splice((function(id) { |
diff --git a/bitbake/lib/toaster/toastergui/tables.py b/bitbake/lib/toaster/toastergui/tables.py index e03aa768c9..003b924d00 100644 --- a/bitbake/lib/toaster/toastergui/tables.py +++ b/bitbake/lib/toaster/toastergui/tables.py | |||
| @@ -23,6 +23,7 @@ from toastergui.widgets import ToasterTable, ToasterTemplateView | |||
| 23 | from orm.models import Recipe, ProjectLayer, Layer_Version, Machine, Project | 23 | from orm.models import Recipe, ProjectLayer, Layer_Version, Machine, Project |
| 24 | from django.db.models import Q, Max | 24 | from django.db.models import Q, Max |
| 25 | from django.conf.urls import url | 25 | from django.conf.urls import url |
| 26 | from django.core.urlresolvers import reverse | ||
| 26 | from django.views.generic import TemplateView | 27 | from django.views.generic import TemplateView |
| 27 | 28 | ||
| 28 | class LayersTable(ToasterTable): | 29 | class LayersTable(ToasterTable): |
| @@ -35,9 +36,9 @@ class LayersTable(ToasterTable): | |||
| 35 | def get_context_data(self, **kwargs): | 36 | def get_context_data(self, **kwargs): |
| 36 | context = super(LayersTable, self).get_context_data(**kwargs) | 37 | context = super(LayersTable, self).get_context_data(**kwargs) |
| 37 | 38 | ||
| 38 | context['project'] = Project.objects.get(pk=kwargs['pid']) | 39 | project = Project.objects.get(pk=kwargs['pid']) |
| 39 | 40 | context['project'] = project | |
| 40 | context['projectlayers'] = map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=context['project'])) | 41 | context['projectlayers'] = map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=project)) |
| 41 | 42 | ||
| 42 | return context | 43 | return context |
| 43 | 44 | ||
| @@ -142,6 +143,13 @@ class LayersTable(ToasterTable): | |||
| 142 | static_data_name="add-del-layers", | 143 | static_data_name="add-del-layers", |
| 143 | static_data_template='{% include "layer_btn.html" %}') | 144 | static_data_template='{% include "layer_btn.html" %}') |
| 144 | 145 | ||
| 146 | project = Project.objects.get(pk=kwargs['pid']) | ||
| 147 | self.add_column(title="LayerDetailsUrl", | ||
| 148 | displayable = False, | ||
| 149 | field_name="layerDetailsUrl", | ||
| 150 | computation = lambda x: reverse('layerdetails', args=(project.id, x.id))) | ||
| 151 | |||
| 152 | |||
| 145 | 153 | ||
| 146 | 154 | ||
| 147 | class LayerDetails(ToasterTemplateView): | 155 | class LayerDetails(ToasterTemplateView): |
| @@ -152,7 +160,8 @@ class LayerDetails(ToasterTemplateView): | |||
| 152 | context['project'] = Project.objects.get(pk=kwargs['pid']) | 160 | context['project'] = Project.objects.get(pk=kwargs['pid']) |
| 153 | context['layerversion'] = Layer_Version.objects.get(pk=kwargs['layerid']) | 161 | context['layerversion'] = Layer_Version.objects.get(pk=kwargs['layerid']) |
| 154 | context['layerdict'] = _lv_to_dict(context['project'], context['layerversion']) | 162 | context['layerdict'] = _lv_to_dict(context['project'], context['layerversion']) |
| 155 | context['layerdeps'] = {"list": [x.depends_on.get_equivalents_wpriority(context['project'])[0] for x in context['layerversion'].dependencies.all()]} | 163 | context['layerdeps'] = {"list": [ |
| 164 | [{"id": y.id, "name": y.layer.name} for y in x.depends_on.get_equivalents_wpriority(context['project'])][0] for x in context['layerversion'].dependencies.all()]} | ||
| 156 | context['projectlayers'] = map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=context['project'])) | 165 | context['projectlayers'] = map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=context['project'])) |
| 157 | 166 | ||
| 158 | self.context_entries = ['project', 'layerversion', 'projectlayers', 'layerdict', 'layerdeps'] | 167 | self.context_entries = ['project', 'layerversion', 'projectlayers', 'layerdict', 'layerdeps'] |
| @@ -265,9 +274,10 @@ class RecipesTable(ToasterTable): | |||
| 265 | self.default_orderby = "name" | 274 | self.default_orderby = "name" |
| 266 | 275 | ||
| 267 | def get_context_data(self, **kwargs): | 276 | def get_context_data(self, **kwargs): |
| 277 | project = Project.objects.get(pk=kwargs['pid']) | ||
| 268 | context = super(RecipesTable, self).get_context_data(**kwargs) | 278 | context = super(RecipesTable, self).get_context_data(**kwargs) |
| 269 | 279 | ||
| 270 | context['project'] = Project.objects.get(pk=kwargs['pid']) | 280 | context['project'] = project |
| 271 | 281 | ||
| 272 | context['projectlayers'] = map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=context['project'])) | 282 | context['projectlayers'] = map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=context['project'])) |
| 273 | 283 | ||
| @@ -342,10 +352,11 @@ class RecipesTable(ToasterTable): | |||
| 342 | static_data_name="add-del-layers", | 352 | static_data_name="add-del-layers", |
| 343 | static_data_template='{% include "recipe_btn.html" %}') | 353 | static_data_template='{% include "recipe_btn.html" %}') |
| 344 | 354 | ||
| 355 | project = Project.objects.get(pk=kwargs['pid']) | ||
| 345 | self.add_column(title="Project compatible Layer ID", | 356 | self.add_column(title="Project compatible Layer ID", |
| 346 | displayable = False, | 357 | displayable = False, |
| 347 | field_name = "projectcompatible_layer", | 358 | field_name = "projectcompatible_layer", |
| 348 | computation = lambda x: (x.layer_version.get_equivalents_wpriority(Project.objects.get(pk=kwargs['pid']))[0])) | 359 | computation = lambda x: (x.layer_version.get_equivalents_wpriority(project)[0])) |
| 349 | 360 | ||
| 350 | class LayerRecipesTable(RecipesTable): | 361 | class LayerRecipesTable(RecipesTable): |
| 351 | """ Smaller version of the Recipes table for use in layer details """ | 362 | """ Smaller version of the Recipes table for use in layer details """ |
diff --git a/bitbake/lib/toaster/toastergui/templates/importlayer.html b/bitbake/lib/toaster/toastergui/templates/importlayer.html index af8f4f985a..498a204aff 100644 --- a/bitbake/lib/toaster/toastergui/templates/importlayer.html +++ b/bitbake/lib/toaster/toastergui/templates/importlayer.html | |||
| @@ -14,7 +14,6 @@ | |||
| 14 | <script> | 14 | <script> |
| 15 | $(document).ready(function (){ | 15 | $(document).ready(function (){ |
| 16 | var ctx = { | 16 | var ctx = { |
| 17 | layerDetailsUrl : "{% url 'base_layerdetails' project.id %}", | ||
| 18 | xhrImportLayerUrl : "{% url 'xhr_importlayer' %}", | 17 | xhrImportLayerUrl : "{% url 'xhr_importlayer' %}", |
| 19 | }; | 18 | }; |
| 20 | 19 | ||
diff --git a/bitbake/lib/toaster/toastergui/templates/layerdetails.html b/bitbake/lib/toaster/toastergui/templates/layerdetails.html index ef1795c0e2..7d81b14b61 100644 --- a/bitbake/lib/toaster/toastergui/templates/layerdetails.html +++ b/bitbake/lib/toaster/toastergui/templates/layerdetails.html | |||
| @@ -34,7 +34,6 @@ | |||
| 34 | $(document).ready(function (){ | 34 | $(document).ready(function (){ |
| 35 | var ctx = { | 35 | var ctx = { |
| 36 | projectBuildsUrl : "{% url 'projectbuilds' project.id %}", | 36 | projectBuildsUrl : "{% url 'projectbuilds' project.id %}", |
| 37 | layerDetailsUrl : "{% url 'base_layerdetails' project.id %}", | ||
| 38 | xhrUpdateLayerUrl : "{% url 'xhr_updatelayer' %}", | 37 | xhrUpdateLayerUrl : "{% url 'xhr_updatelayer' %}", |
| 39 | layerVersion : { | 38 | layerVersion : { |
| 40 | name : "{{layerversion.layer.name}}", | 39 | name : "{{layerversion.layer.name}}", |
diff --git a/bitbake/lib/toaster/toastergui/templates/project.html b/bitbake/lib/toaster/toastergui/templates/project.html index 63fbc40f55..7225363c01 100644 --- a/bitbake/lib/toaster/toastergui/templates/project.html +++ b/bitbake/lib/toaster/toastergui/templates/project.html | |||
| @@ -455,7 +455,6 @@ angular.element(document).ready(function() { | |||
| 455 | scope.urls.targets = "{% url 'projecttargets' project.id %}"; | 455 | scope.urls.targets = "{% url 'projecttargets' project.id %}"; |
| 456 | scope.urls.machines = "{% url 'projectmachines' project.id %}"; | 456 | scope.urls.machines = "{% url 'projectmachines' project.id %}"; |
| 457 | scope.urls.importlayer = "{% url 'importlayer' project.id %}"; | 457 | scope.urls.importlayer = "{% url 'importlayer' project.id %}"; |
| 458 | scope.urls.layer = "{% url 'base_layerdetails' project.id %}"; | ||
| 459 | scope.project = {{prj|json}}; | 458 | scope.project = {{prj|json}}; |
| 460 | scope.builds = {{builds|json}}; | 459 | scope.builds = {{builds|json}}; |
| 461 | scope.layers = {{layers|json}}; | 460 | scope.layers = {{layers|json}}; |
diff --git a/bitbake/lib/toaster/toastergui/urls.py b/bitbake/lib/toaster/toastergui/urls.py index f1b74cdd14..5a79f88eb4 100644 --- a/bitbake/lib/toaster/toastergui/urls.py +++ b/bitbake/lib/toaster/toastergui/urls.py | |||
| @@ -80,12 +80,9 @@ urlpatterns = patterns('toastergui.views', | |||
| 80 | url(r'^project/(?P<pid>\d+)/configuration$', 'projectconf', name='projectconf'), | 80 | url(r'^project/(?P<pid>\d+)/configuration$', 'projectconf', name='projectconf'), |
| 81 | url(r'^project/(?P<pid>\d+)/builds/$', 'projectbuilds', name='projectbuilds'), | 81 | url(r'^project/(?P<pid>\d+)/builds/$', 'projectbuilds', name='projectbuilds'), |
| 82 | 82 | ||
| 83 | url(r'^project/(?P<pid>\d+)/layer/$', lambda x,pid: HttpResponseBadRequest(), name='base_layerdetails'), | ||
| 84 | |||
| 85 | # the import layer is a project-specific functionality; | 83 | # the import layer is a project-specific functionality; |
| 86 | url(r'^project/(?P<pid>\d+)/importlayer$', 'importlayer', name='importlayer'), | 84 | url(r'^project/(?P<pid>\d+)/importlayer$', 'importlayer', name='importlayer'), |
| 87 | 85 | ||
| 88 | |||
| 89 | # the table pages that have been converted to ToasterTable widget | 86 | # the table pages that have been converted to ToasterTable widget |
| 90 | url(r'^project/(?P<pid>\d+)/machines/$', | 87 | url(r'^project/(?P<pid>\d+)/machines/$', |
| 91 | tables.MachinesTable.as_view(template_name="generic-toastertable-page.html"), | 88 | tables.MachinesTable.as_view(template_name="generic-toastertable-page.html"), |
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index 5221f1f728..b2b263b6e0 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py | |||
| @@ -2238,7 +2238,7 @@ if toastermain.settings.MANAGED: | |||
| 2238 | if request.method == "POST": | 2238 | if request.method == "POST": |
| 2239 | # add layers | 2239 | # add layers |
| 2240 | if 'layerAdd' in request.POST: | 2240 | if 'layerAdd' in request.POST: |
| 2241 | for lc in Layer_Version.objects.filter(pk__in=request.POST['layerAdd'].split(",")): | 2241 | for lc in Layer_Version.objects.filter(pk__in=[i for i in request.POST['layerAdd'].split(",") if len(i) > 0]): |
| 2242 | ProjectLayer.objects.get_or_create(project = prj, layercommit = lc) | 2242 | ProjectLayer.objects.get_or_create(project = prj, layercommit = lc) |
| 2243 | 2243 | ||
| 2244 | # remove layers | 2244 | # remove layers |
| @@ -2328,15 +2328,6 @@ if toastermain.settings.MANAGED: | |||
| 2328 | try: | 2328 | try: |
| 2329 | prj = Project.objects.get(pk = pid) | 2329 | prj = Project.objects.get(pk = pid) |
| 2330 | 2330 | ||
| 2331 | # returns layer dependencies for a layer, excluding current project layers | ||
| 2332 | if request.GET.get('type', None) == "layerdeps": | ||
| 2333 | queryset = prj.compatible_layerversions().exclude(pk__in = [x.id for x in prj.projectlayer_equivalent_set()]).filter( | ||
| 2334 | layer__name__in = [ x.depends_on.layer.name for x in LayerVersionDependency.objects.filter(layer_version_id = request.GET.get('search', None))]) | ||
| 2335 | |||
| 2336 | final_list = set([x.get_equivalents_wpriority(prj)[0] for x in queryset]) | ||
| 2337 | |||
| 2338 | return HttpResponse(jsonfilter( { "error":"ok", "list" : map( _lv_to_dict(prj), sorted(final_list, key = lambda x: x.layer.name)) }), content_type = "application/json") | ||
| 2339 | |||
| 2340 | 2331 | ||
| 2341 | # returns layer versions that would be deleted on the new release__pk | 2332 | # returns layer versions that would be deleted on the new release__pk |
| 2342 | if request.GET.get('type', None) == "versionlayers": | 2333 | if request.GET.get('type', None) == "versionlayers": |
