diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2015-06-08 18:33:44 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-06-12 00:01:49 +0100 |
commit | 58cd4a14ea81b72dcd9679608e5e2231ec3d3631 (patch) | |
tree | 15cea3afb06ad5ae448fbf2fb65bfb4cb7535308 /bitbake/lib/toaster/toastergui/static/js/projectapp.js | |
parent | 27f5137cd6143b523e9aea8eeba406337aa935c4 (diff) | |
download | poky-58cd4a14ea81b72dcd9679608e5e2231ec3d3631.tar.gz |
bitbake: toaster: fixes after refactoring
This patch fixes issues brought in by refactoring:
* the New Build button is working with pre-set projects
* the xhr_datatypeahead is exposed for calls that are not
mapable to the REST objects
* a new table returing recipes provided by layers currently
selected in the project is used to provide recipe suggestions
* the field names in json are switched from "list" to "rows" as
to maintain consistency with the ToasterTables
* the "value" field in xhr_ calls is now named "search" to maintain
consistency
(Bitbake rev: a5bc29083d4f85a5695f3f62d5badb783c6f7224)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/static/js/projectapp.js')
-rw-r--r-- | bitbake/lib/toaster/toastergui/static/js/projectapp.js | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/projectapp.js b/bitbake/lib/toaster/toastergui/static/js/projectapp.js index a915278444..44e244d302 100644 --- a/bitbake/lib/toaster/toastergui/static/js/projectapp.js +++ b/bitbake/lib/toaster/toastergui/static/js/projectapp.js | |||
@@ -217,13 +217,13 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc | |||
217 | $scope.getAutocompleteSuggestions = function(type, currentValue) { | 217 | $scope.getAutocompleteSuggestions = function(type, currentValue) { |
218 | var deffered = $q.defer(); | 218 | var deffered = $q.defer(); |
219 | 219 | ||
220 | $http({method:"GET", url: $scope.urls.xhr_datatypeahead, params : { type: type, value: currentValue}}) | 220 | $http({method:"GET", url: $scope.urls.xhr_datatypeahead, params : { type: type, search: currentValue}}) |
221 | .success(function (_data) { | 221 | .success(function (_data) { |
222 | if (_data.error != "ok") { | 222 | if (_data.error != "ok") { |
223 | console.warn(_data.error); | 223 | console.warn(_data.error); |
224 | deffered.reject(_data.error); | 224 | deffered.reject(_data.error); |
225 | } | 225 | } |
226 | deffered.resolve(_data.list); | 226 | deffered.resolve(_data.rows); |
227 | }); | 227 | }); |
228 | 228 | ||
229 | return deffered.promise; | 229 | return deffered.promise; |
@@ -534,8 +534,17 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc | |||
534 | if (_data.error != "ok") { | 534 | if (_data.error != "ok") { |
535 | console.warn(_data.error); | 535 | console.warn(_data.error); |
536 | } else { | 536 | } else { |
537 | console.log("got layer deps", _data.layerdeps.list); | 537 | /* filter out layers that are already in the project */ |
538 | if (_data.layerdeps.list.length > 0) { | 538 | var filtered_list = []; |
539 | var projectlayers_ids = $scope.layers.map(function (e) { return e.id }); | ||
540 | for (var i = 0; i < _data.layerdeps.list.length; i++) { | ||
541 | if (projectlayers_ids.indexOf(_data.layerdeps.list[i].id) == -1) { | ||
542 | filtered_list.push( _data.layerdeps.list[i]); | ||
543 | } | ||
544 | } | ||
545 | |||
546 | _data.layerdeps.list = filtered_list; | ||
547 | if (_data.layerdeps.list.length > 0) { | ||
539 | // activate modal | 548 | // activate modal |
540 | console.log("listing modals"); | 549 | console.log("listing modals"); |
541 | var modalInstance = $modal.open({ | 550 | var modalInstance = $modal.open({ |
@@ -575,7 +584,6 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc | |||
575 | console.log("built modal instance", modalInstance); | 584 | console.log("built modal instance", modalInstance); |
576 | 585 | ||
577 | modalInstance.result.then(function (selectedArray) { | 586 | modalInstance.result.then(function (selectedArray) { |
578 | console.log("layer to add", $scope.layerToAdd) | ||
579 | selectedArray.push($scope.layerToAdd.id); | 587 | selectedArray.push($scope.layerToAdd.id); |
580 | console.warn("TRC6: selected", selectedArray); | 588 | console.warn("TRC6: selected", selectedArray); |
581 | 589 | ||
@@ -634,13 +642,13 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc | |||
634 | $scope.testProjectSettingsChange = function(elementid) { | 642 | $scope.testProjectSettingsChange = function(elementid) { |
635 | if (elementid != '#change-project-version') throw "Not implemented"; | 643 | if (elementid != '#change-project-version') throw "Not implemented"; |
636 | 644 | ||
637 | $http({method:"GET", url: $scope.urls.xhr_datatypeahead, params : { type: "versionlayers", value: $scope.projectVersion }}). | 645 | $http({method:"GET", url: $scope.urls.xhr_datatypeahead, params : { type: "versionlayers", search: $scope.projectVersion }}). |
638 | success(function (_data) { | 646 | success(function (_data) { |
639 | if (_data.error != "ok") { | 647 | if (_data.error != "ok") { |
640 | alert (_data.error); | 648 | alert (_data.error); |
641 | } | 649 | } |
642 | else { | 650 | else { |
643 | if (_data.list.length > 0) { | 651 | if (_data.rows.length > 0) { |
644 | // activate modal | 652 | // activate modal |
645 | var modalInstance = $modal.open({ | 653 | var modalInstance = $modal.open({ |
646 | templateUrl: 'change_version_modal', | 654 | templateUrl: 'change_version_modal', |
@@ -660,7 +668,7 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc | |||
660 | }, | 668 | }, |
661 | resolve: { | 669 | resolve: { |
662 | items: function () { | 670 | items: function () { |
663 | return _data.list; | 671 | return _data.rows; |
664 | }, | 672 | }, |
665 | releaseName: function () { | 673 | releaseName: function () { |
666 | return $scope.releases.filter(function (e) { if (e.id == $scope.projectVersion) return e;})[0].name; | 674 | return $scope.releases.filter(function (e) { if (e.id == $scope.projectVersion) return e;})[0].name; |