diff --git a/engines/bastion/app/assets/javascripts/bastion/activation-keys/details/activation-key-details-info.controller.js b/engines/bastion/app/assets/javascripts/bastion/activation-keys/details/activation-key-details-info.controller.js index cf9be3049e3..3797e08e368 100644 --- a/engines/bastion/app/assets/javascripts/bastion/activation-keys/details/activation-key-details-info.controller.js +++ b/engines/bastion/app/assets/javascripts/bastion/activation-keys/details/activation-key-details-info.controller.js @@ -67,7 +67,7 @@ angular.module('Bastion.activation-keys').controller('ActivationKeyDetailsInfoCo $scope.contentViews = function () { var deferred = $q.defer(); - ContentView.query({ 'environment_id': $scope.activationKey.environment.id }, function (response) { + ContentView.queryUnpaged({ 'environment_id': $scope.activationKey.environment.id }, function (response) { deferred.resolve(response.results); }); diff --git a/engines/bastion/app/assets/javascripts/bastion/activation-keys/new/new-activation-key.controller.js b/engines/bastion/app/assets/javascripts/bastion/activation-keys/new/new-activation-key.controller.js index 06d69f530a9..6e4066371d0 100644 --- a/engines/bastion/app/assets/javascripts/bastion/activation-keys/new/new-activation-key.controller.js +++ b/engines/bastion/app/assets/javascripts/bastion/activation-keys/new/new-activation-key.controller.js @@ -36,7 +36,6 @@ angular.module('Bastion.activation-keys').controller('NewActivationKeyController $scope.contentViews = []; $scope.editContentView = false; - $scope.disableEnvironmentSelection = false; $scope.environments = []; $scope.environments = Organization.registerableEnvironments({organizationId: CurrentOrganization}); @@ -51,8 +50,7 @@ angular.module('Bastion.activation-keys').controller('NewActivationKeyController $scope.$watch('activationKey.environment', function (environment) { if (environment) { $scope.editContentView = true; - $scope.disableEnvironmentSelection = true; - ContentView.query({ 'environment_id': environment.id }, function (response) { + ContentView.queryUnpaged({ 'environment_id': environment.id }, function (response) { $scope.contentViews = response.results; }); } diff --git a/engines/bastion/app/assets/javascripts/bastion/activation-keys/new/views/activation-key-new.html b/engines/bastion/app/assets/javascripts/bastion/activation-keys/new/views/activation-key-new.html index 124fe188116..5b88a4c71b5 100644 --- a/engines/bastion/app/assets/javascripts/bastion/activation-keys/new/views/activation-key-new.html +++ b/engines/bastion/app/assets/javascripts/bastion/activation-keys/new/views/activation-key-new.html @@ -68,14 +68,14 @@

New Activation Key

+ mode="singleSelect">
- - - If the content view selector list is blank you will need to choose a different environment that contains at least one content view. + + The selected environment contains no Content Views, please select a different environment. + + + Please select an environment.
diff --git a/engines/bastion/app/assets/javascripts/bastion/content-views/content-view.factory.js b/engines/bastion/app/assets/javascripts/bastion/content-views/content-view.factory.js index ce48b6b0202..6eb5d4d8616 100644 --- a/engines/bastion/app/assets/javascripts/bastion/content-views/content-view.factory.js +++ b/engines/bastion/app/assets/javascripts/bastion/content-views/content-view.factory.js @@ -28,7 +28,8 @@ angular.module('Bastion.content-views').factory('ContentView', return $resource('/api/v2/content_views/:id/:action', {id: '@id', 'organization_id': CurrentOrganization}, { - query: {method: 'GET', isArray: false, params: {nondefault: true}}, + queryPaged: {method: 'GET', isArray: false}, + queryUnpaged: {method: 'GET', isArray: false, params: {'full_result': true}}, update: {method: 'PUT'}, publish: {method: 'POST', params: {action: 'publish'}}, history: {method: 'GET', params: {action: 'history'}}, diff --git a/engines/bastion/app/assets/javascripts/bastion/content-views/content-views.controller.js b/engines/bastion/app/assets/javascripts/bastion/content-views/content-views.controller.js index 861fa204d4f..01a8f0dc42e 100644 --- a/engines/bastion/app/assets/javascripts/bastion/content-views/content-views.controller.js +++ b/engines/bastion/app/assets/javascripts/bastion/content-views/content-views.controller.js @@ -30,10 +30,11 @@ angular.module('Bastion.content-views').controller('ContentViewsController', function ($scope, Nutupane, ContentView, CurrentOrganization) { var nutupane = new Nutupane(ContentView, { + 'nondefault': true, 'organization_id': CurrentOrganization, 'sort_by': 'name', 'sort_order': 'ASC' - }); + }, 'queryPaged'); $scope.table = nutupane.table; $scope.removeRow = nutupane.removeRow; diff --git a/engines/bastion/app/assets/javascripts/bastion/content-views/new/content-view-new.controller.js b/engines/bastion/app/assets/javascripts/bastion/content-views/new/content-view-new.controller.js index 54834f97f69..566218354a9 100644 --- a/engines/bastion/app/assets/javascripts/bastion/content-views/new/content-view-new.controller.js +++ b/engines/bastion/app/assets/javascripts/bastion/content-views/new/content-view-new.controller.js @@ -30,10 +30,6 @@ angular.module('Bastion.content-views').controller('NewContentViewController', $scope.createOption = 'new'; $scope.table = {}; - ContentView.query({}, function (response) { - $scope.table.rows = response.results; - }); - $scope.save = function (contentView) { contentView.$save(success, error); }; diff --git a/engines/bastion/app/assets/javascripts/bastion/systems/bulk/systems-bulk-action-environment.controller.js b/engines/bastion/app/assets/javascripts/bastion/systems/bulk/systems-bulk-action-environment.controller.js index fe9a73189a4..afc39f47053 100644 --- a/engines/bastion/app/assets/javascripts/bastion/systems/bulk/systems-bulk-action-environment.controller.js +++ b/engines/bastion/app/assets/javascripts/bastion/systems/bulk/systems-bulk-action-environment.controller.js @@ -45,7 +45,7 @@ angular.module('Bastion.systems').controller('SystemsBulkActionEnvironmentContro $scope.fetchViews = function () { $scope.fetchingContentViews = true; - ContentView.query({ 'environment_id': $scope.selected.environment.id }, function (response) { + ContentView.queryUnpaged({ 'environment_id': $scope.selected.environment.id }, function (response) { $scope.contentViews = response.results; $scope.fetchingContentViews = false; }); diff --git a/engines/bastion/app/assets/javascripts/bastion/systems/details/system-details-info.controller.js b/engines/bastion/app/assets/javascripts/bastion/systems/details/system-details-info.controller.js index 07f492237ff..0b518c1b7a3 100644 --- a/engines/bastion/app/assets/javascripts/bastion/systems/details/system-details-info.controller.js +++ b/engines/bastion/app/assets/javascripts/bastion/systems/details/system-details-info.controller.js @@ -87,7 +87,7 @@ angular.module('Bastion.systems').controller('SystemDetailsInfoController', $scope.contentViews = function () { var deferred = $q.defer(); - ContentView.query({ 'environment_id': $scope.system.environment.id }, function (response) { + ContentView.queryUnpaged({ 'environment_id': $scope.system.environment.id}, function (response) { deferred.resolve(response.results); }); diff --git a/engines/bastion/test/activation-keys/new/new-activation-key.controller.test.js b/engines/bastion/test/activation-keys/new/new-activation-key.controller.test.js index cee6fdffe47..d3621a91116 100644 --- a/engines/bastion/test/activation-keys/new/new-activation-key.controller.test.js +++ b/engines/bastion/test/activation-keys/new/new-activation-key.controller.test.js @@ -51,7 +51,7 @@ describe('Controller: NewActivationKeyController', function() { }; ContentView = $injector.get('MockResource').$new(); - ContentView.query = function (params, callback) {}; + ContentView.unPaged = function (params, callback) {}; FormUtils = $injector.get('FormUtils'); @@ -151,11 +151,11 @@ describe('Controller: NewActivationKeyController', function() { it("should fetch content views", function () { $httpBackend.expectGET('/organizations/default_label?name=Test+Resource').respond('changed_name'); - spyOn(ContentView, 'query'); + spyOn(ContentView, 'queryUnpaged'); $scope.activationKey.environment = paths[0][0]; $scope.$apply(); - expect(ContentView.query).toHaveBeenCalled(); + expect(ContentView.queryUnpaged).toHaveBeenCalled(); }); }); diff --git a/engines/bastion/test/content-views/content-view.factory.test.js b/engines/bastion/test/content-views/content-view.factory.test.js index 4aa42bcd091..e2bab3bad6d 100644 --- a/engines/bastion/test/content-views/content-view.factory.test.js +++ b/engines/bastion/test/content-views/content-view.factory.test.js @@ -46,10 +46,10 @@ describe('Factory: ContentView', function() { }); it('provides a way to get a collection of content views', function() { - $httpBackend.expectGET('/api/v2/content_views?nondefault=true&organization_id=ACME') + $httpBackend.expectGET('/api/v2/content_views?organization_id=ACME') .respond(contentViews); - ContentView.query(function (response) { + ContentView.queryPaged(function (response) { var views = response; expect(views.results.length).toBe(2); diff --git a/engines/bastion/test/systems/bulk/systems-bulk-action-environment.controller.test.js b/engines/bastion/test/systems/bulk/systems-bulk-action-environment.controller.test.js index 1689ff55134..b7b15076374 100644 --- a/engines/bastion/test/systems/bulk/systems-bulk-action-environment.controller.test.js +++ b/engines/bastion/test/systems/bulk/systems-bulk-action-environment.controller.test.js @@ -22,10 +22,11 @@ describe('Controller: SystemsBulkActionEnvironmentController', function() { }; CurrentOrganization = 'foo'; - paths = [[{name: "Library", id: 1}, {name: "Dev", id: 2}]] + paths = [[{name: "Library", id: 1}, {name: "Dev", id: 2}]]; selectedSystems = {included: {ids: [1, 2, 3]}}; ContentView = $injector.get('MockResource').$new(); Organization = $injector.get('MockResource').$new(); + ContentView.queryUnpaged = function(){return {}}; Organization.registerableEnvironments = function (params, callback) { var response = paths; @@ -64,11 +65,11 @@ describe('Controller: SystemsBulkActionEnvironmentController', function() { it("should fetch content views", function () { $scope.selected.environment = paths[0][0]; - spyOn(ContentView, 'query').andCallThrough(); + spyOn(ContentView, 'queryUnpaged').andCallThrough(); $scope.fetchViews(); - expect(ContentView.query).toHaveBeenCalled(); - expect($scope.contentViews).toBe(ContentView.query().results); + expect(ContentView.queryUnpaged).toHaveBeenCalled(); + expect($scope.contentViews).toBe(ContentView.queryUnpaged().results); }); it("should perform the correct action", function () { diff --git a/engines/bastion/test/systems/details/system-details-info.controller.test.js b/engines/bastion/test/systems/details/system-details-info.controller.test.js index fa1658387db..643c943724c 100644 --- a/engines/bastion/test/systems/details/system-details-info.controller.test.js +++ b/engines/bastion/test/systems/details/system-details-info.controller.test.js @@ -39,6 +39,7 @@ describe('Controller: SystemDetailsInfoController', function() { System = $injector.get('MockResource').$new(); $scope = $injector.get('$rootScope').$new(); + ContentView.queryUnpaged = function(){}; System.releaseVersions = function(params, callback) { callback.apply(this, [['RHEL6']]); }; diff --git a/engines/bastion/test/test-mocks.module.js b/engines/bastion/test/test-mocks.module.js index 900db9c177e..a840033cb06 100644 --- a/engines/bastion/test/test-mocks.module.js +++ b/engines/bastion/test/test-mocks.module.js @@ -123,6 +123,8 @@ angular.module('Bastion.test-mocks').factory('MockResource', function () { } return Resource.mockResources; }; + Resource.queryPaged = Resource.query; + Resource.queryUnpaged = Resource.query; Resource.save = function(params, data, success, error) { var item = new Resource(data);