From 4ade498c6c52def84c72142553a73b40211773f4 Mon Sep 17 00:00:00 2001 From: Leigh Johnson Date: Fri, 12 Feb 2016 11:08:47 -0500 Subject: [PATCH 1/3] #646 add pagination support to setup > organizations, pass orgCount as pageSize, handle case where a 2nd page might be visible for an unusually high # of orgs, fix breadcrumb shown in organization.edit state --- awx/ui/client/src/app.js | 4 ++ .../client/src/controllers/Organizations.js | 52 ++++++++++++++++--- awx/ui/client/src/partials/organizations.html | 4 +- 3 files changed, 51 insertions(+), 9 deletions(-) diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js index c0b72d9dcf..7c60dc2e80 100644 --- a/awx/ui/client/src/app.js +++ b/awx/ui/client/src/app.js @@ -613,6 +613,10 @@ var tower = angular.module('Tower', [ data: { activityStreamId: 'organization_id' }, + ncyBreadcrumb: { + parent: "organizations", + label: "EDIT {{name}}" + }, resolve: { features: ['FeaturesService', function(FeaturesService) { return FeaturesService.get(); diff --git a/awx/ui/client/src/controllers/Organizations.js b/awx/ui/client/src/controllers/Organizations.js index c4966d257c..976e056722 100644 --- a/awx/ui/client/src/controllers/Organizations.js +++ b/awx/ui/client/src/controllers/Organizations.js @@ -12,13 +12,38 @@ export function OrganizationsList($stateParams, $scope, $rootScope, $location, - $log, Rest, Alert, Prompt, ClearScope, ProcessErrors, GetBasePath, Wait, - $state) { + $log, $compile, Rest, PaginateWidget, PaginateInit, SearchInit, OrganizationList, Alert, Prompt, ClearScope, ProcessErrors, GetBasePath, Wait, + Stream, $state) { ClearScope(); - var defaultUrl = GetBasePath('organizations'); + var defaultUrl = GetBasePath('organizations'), + list = OrganizationList, + pageSize = $scope.orgCount; + PaginateInit({ + scope: $scope, + list: list, + url: defaultUrl, + pageSize: pageSize, + }); + SearchInit({ + scope: $scope, + list: list, + url: defaultUrl, + }); + + $scope.search(list.iterator); + + $scope.PaginateWidget = PaginateWidget({ + iterator: list.iterator, + set: 'organizations' + }); + + var paginationContainer = $('#pagination-container'); + paginationContainer.html($scope.PaginateWidget); + $compile(paginationContainer.contents())($scope) + var parseCardData = function (cards) { return cards.map(function (card) { var val = {}; @@ -111,6 +136,10 @@ export function OrganizationsList($stateParams, $scope, $rootScope, $location, $('#prompt-modal').modal('hide'); }); + $scope.showActivity = function () { + Stream({ scope: $scope }); + }; + $scope.addOrganization = function () { $state.transitionTo('organizations.add'); }; @@ -150,9 +179,9 @@ export function OrganizationsList($stateParams, $scope, $rootScope, $location, } OrganizationsList.$inject = ['$stateParams', '$scope', '$rootScope', - '$location', '$log', 'Rest', 'Alert', 'Prompt', 'ClearScope', + '$location', '$log', '$compile', 'Rest', 'PaginateWidget', 'PaginateInit', 'SearchInit', 'OrganizationList', 'Alert', 'Prompt', 'ClearScope', 'ProcessErrors', 'GetBasePath', 'Wait', - '$state' + 'Stream', '$state' ]; @@ -167,6 +196,7 @@ export function OrganizationsAdd($scope, $rootScope, $compile, $location, $log, form = OrganizationForm, base = $location.path().replace(/^\//, '').split('/')[0]; + generator.inject(form, { mode: 'add', related: false, scope: $scope}); generator.reset(); @@ -213,7 +243,7 @@ OrganizationsAdd.$inject = ['$scope', '$rootScope', '$compile', '$location', export function OrganizationsEdit($scope, $rootScope, $compile, $location, $log, $stateParams, OrganizationForm, GenerateForm, Rest, Alert, ProcessErrors, RelatedSearchInit, RelatedPaginateInit, Prompt, ClearScope, GetBasePath, - Wait, $state) { + Wait, Stream, $state) { ClearScope(); @@ -302,6 +332,12 @@ export function OrganizationsEdit($scope, $rootScope, $compile, $location, $log, }); }; + $scope.showActivity = function () { + Stream({ + scope: $scope + }); + }; + $scope.formCancel = function () { $scope.$emit("ReloadOrganzationCards"); $scope.$emit("ShowOrgListHeader"); @@ -353,5 +389,5 @@ export function OrganizationsEdit($scope, $rootScope, $compile, $location, $log, OrganizationsEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$stateParams', 'OrganizationForm', 'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'RelatedSearchInit', 'RelatedPaginateInit', 'Prompt', - 'ClearScope', 'GetBasePath', 'Wait', '$state' -]; + 'ClearScope', 'GetBasePath', 'Wait', 'Stream', '$state' +]; \ No newline at end of file diff --git a/awx/ui/client/src/partials/organizations.html b/awx/ui/client/src/partials/organizations.html index b59c4c675c..c04044ac94 100644 --- a/awx/ui/client/src/partials/organizations.html +++ b/awx/ui/client/src/partials/organizations.html @@ -57,4 +57,6 @@ - +
+
+ \ No newline at end of file From 4558b880a0af2448d74f2ff90a9b14dd5457318e Mon Sep 17 00:00:00 2001 From: Leigh Johnson Date: Fri, 12 Feb 2016 11:26:33 -0500 Subject: [PATCH 2/3] remove Stream dependencies --- awx/ui/client/src/controllers/Organizations.js | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/awx/ui/client/src/controllers/Organizations.js b/awx/ui/client/src/controllers/Organizations.js index 976e056722..bf308dfc1c 100644 --- a/awx/ui/client/src/controllers/Organizations.js +++ b/awx/ui/client/src/controllers/Organizations.js @@ -13,7 +13,7 @@ export function OrganizationsList($stateParams, $scope, $rootScope, $location, $log, $compile, Rest, PaginateWidget, PaginateInit, SearchInit, OrganizationList, Alert, Prompt, ClearScope, ProcessErrors, GetBasePath, Wait, - Stream, $state) { + $state) { ClearScope(); @@ -136,9 +136,7 @@ export function OrganizationsList($stateParams, $scope, $rootScope, $location, $('#prompt-modal').modal('hide'); }); - $scope.showActivity = function () { - Stream({ scope: $scope }); - }; + $scope.addOrganization = function () { $state.transitionTo('organizations.add'); @@ -181,7 +179,7 @@ export function OrganizationsList($stateParams, $scope, $rootScope, $location, OrganizationsList.$inject = ['$stateParams', '$scope', '$rootScope', '$location', '$log', '$compile', 'Rest', 'PaginateWidget', 'PaginateInit', 'SearchInit', 'OrganizationList', 'Alert', 'Prompt', 'ClearScope', 'ProcessErrors', 'GetBasePath', 'Wait', - 'Stream', '$state' + '$state' ]; @@ -243,7 +241,7 @@ OrganizationsAdd.$inject = ['$scope', '$rootScope', '$compile', '$location', export function OrganizationsEdit($scope, $rootScope, $compile, $location, $log, $stateParams, OrganizationForm, GenerateForm, Rest, Alert, ProcessErrors, RelatedSearchInit, RelatedPaginateInit, Prompt, ClearScope, GetBasePath, - Wait, Stream, $state) { + Wait, $state) { ClearScope(); @@ -332,12 +330,6 @@ export function OrganizationsEdit($scope, $rootScope, $compile, $location, $log, }); }; - $scope.showActivity = function () { - Stream({ - scope: $scope - }); - }; - $scope.formCancel = function () { $scope.$emit("ReloadOrganzationCards"); $scope.$emit("ShowOrgListHeader"); @@ -389,5 +381,5 @@ export function OrganizationsEdit($scope, $rootScope, $compile, $location, $log, OrganizationsEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$stateParams', 'OrganizationForm', 'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'RelatedSearchInit', 'RelatedPaginateInit', 'Prompt', - 'ClearScope', 'GetBasePath', 'Wait', 'Stream', '$state' + 'ClearScope', 'GetBasePath', 'Wait', '$state' ]; \ No newline at end of file From 9278a5002925bd95baf72fc9cf054a7098503bcf Mon Sep 17 00:00:00 2001 From: Leigh Johnson Date: Mon, 15 Feb 2016 11:36:46 -0500 Subject: [PATCH 3/3] remove EDIT from edit org breadcrumb label, trim whitespace, add text-uppercase to .BreadCrumb-item --- awx/ui/client/src/app.js | 2 +- awx/ui/client/src/bread-crumb/bread-crumb.block.less | 1 + awx/ui/client/src/controllers/Organizations.js | 3 --- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js index 7c60dc2e80..b62191f36e 100644 --- a/awx/ui/client/src/app.js +++ b/awx/ui/client/src/app.js @@ -615,7 +615,7 @@ var tower = angular.module('Tower', [ }, ncyBreadcrumb: { parent: "organizations", - label: "EDIT {{name}}" + label: "{{name}}" }, resolve: { features: ['FeaturesService', function(FeaturesService) { diff --git a/awx/ui/client/src/bread-crumb/bread-crumb.block.less b/awx/ui/client/src/bread-crumb/bread-crumb.block.less index e1397788d0..de05b2f113 100644 --- a/awx/ui/client/src/bread-crumb/bread-crumb.block.less +++ b/awx/ui/client/src/bread-crumb/bread-crumb.block.less @@ -52,6 +52,7 @@ .BreadCrumb-item { display: inline-block; color: #B7B7B7; + text-transform: uppercase; } .BreadCrumb-item + .BreadCrumb-item:before { diff --git a/awx/ui/client/src/controllers/Organizations.js b/awx/ui/client/src/controllers/Organizations.js index bf308dfc1c..fb1ebecfa1 100644 --- a/awx/ui/client/src/controllers/Organizations.js +++ b/awx/ui/client/src/controllers/Organizations.js @@ -136,8 +136,6 @@ export function OrganizationsList($stateParams, $scope, $rootScope, $location, $('#prompt-modal').modal('hide'); }); - - $scope.addOrganization = function () { $state.transitionTo('organizations.add'); }; @@ -194,7 +192,6 @@ export function OrganizationsAdd($scope, $rootScope, $compile, $location, $log, form = OrganizationForm, base = $location.path().replace(/^\//, '').split('/')[0]; - generator.inject(form, { mode: 'add', related: false, scope: $scope}); generator.reset();