#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

This commit is contained in:
Leigh Johnson
2016-02-12 11:08:47 -05:00
parent 1bcc3b9269
commit 4ade498c6c
3 changed files with 51 additions and 9 deletions

View File

@@ -613,6 +613,10 @@ var tower = angular.module('Tower', [
data: { data: {
activityStreamId: 'organization_id' activityStreamId: 'organization_id'
}, },
ncyBreadcrumb: {
parent: "organizations",
label: "EDIT {{name}}"
},
resolve: { resolve: {
features: ['FeaturesService', function(FeaturesService) { features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get(); return FeaturesService.get();

View File

@@ -12,13 +12,38 @@
export function OrganizationsList($stateParams, $scope, $rootScope, $location, export function OrganizationsList($stateParams, $scope, $rootScope, $location,
$log, Rest, Alert, Prompt, ClearScope, ProcessErrors, GetBasePath, Wait, $log, $compile, Rest, PaginateWidget, PaginateInit, SearchInit, OrganizationList, Alert, Prompt, ClearScope, ProcessErrors, GetBasePath, Wait,
$state) { Stream, $state) {
ClearScope(); 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) { var parseCardData = function (cards) {
return cards.map(function (card) { return cards.map(function (card) {
var val = {}; var val = {};
@@ -111,6 +136,10 @@ export function OrganizationsList($stateParams, $scope, $rootScope, $location,
$('#prompt-modal').modal('hide'); $('#prompt-modal').modal('hide');
}); });
$scope.showActivity = function () {
Stream({ scope: $scope });
};
$scope.addOrganization = function () { $scope.addOrganization = function () {
$state.transitionTo('organizations.add'); $state.transitionTo('organizations.add');
}; };
@@ -150,9 +179,9 @@ export function OrganizationsList($stateParams, $scope, $rootScope, $location,
} }
OrganizationsList.$inject = ['$stateParams', '$scope', '$rootScope', 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', 'ProcessErrors', 'GetBasePath', 'Wait',
'$state' 'Stream', '$state'
]; ];
@@ -167,6 +196,7 @@ export function OrganizationsAdd($scope, $rootScope, $compile, $location, $log,
form = OrganizationForm, form = OrganizationForm,
base = $location.path().replace(/^\//, '').split('/')[0]; base = $location.path().replace(/^\//, '').split('/')[0];
generator.inject(form, { mode: 'add', related: false, scope: $scope}); generator.inject(form, { mode: 'add', related: false, scope: $scope});
generator.reset(); generator.reset();
@@ -213,7 +243,7 @@ OrganizationsAdd.$inject = ['$scope', '$rootScope', '$compile', '$location',
export function OrganizationsEdit($scope, $rootScope, $compile, $location, $log, export function OrganizationsEdit($scope, $rootScope, $compile, $location, $log,
$stateParams, OrganizationForm, GenerateForm, Rest, Alert, ProcessErrors, $stateParams, OrganizationForm, GenerateForm, Rest, Alert, ProcessErrors,
RelatedSearchInit, RelatedPaginateInit, Prompt, ClearScope, GetBasePath, RelatedSearchInit, RelatedPaginateInit, Prompt, ClearScope, GetBasePath,
Wait, $state) { Wait, Stream, $state) {
ClearScope(); ClearScope();
@@ -302,6 +332,12 @@ export function OrganizationsEdit($scope, $rootScope, $compile, $location, $log,
}); });
}; };
$scope.showActivity = function () {
Stream({
scope: $scope
});
};
$scope.formCancel = function () { $scope.formCancel = function () {
$scope.$emit("ReloadOrganzationCards"); $scope.$emit("ReloadOrganzationCards");
$scope.$emit("ShowOrgListHeader"); $scope.$emit("ShowOrgListHeader");
@@ -353,5 +389,5 @@ export function OrganizationsEdit($scope, $rootScope, $compile, $location, $log,
OrganizationsEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', OrganizationsEdit.$inject = ['$scope', '$rootScope', '$compile', '$location',
'$log', '$stateParams', 'OrganizationForm', 'GenerateForm', 'Rest', 'Alert', '$log', '$stateParams', 'OrganizationForm', 'GenerateForm', 'Rest', 'Alert',
'ProcessErrors', 'RelatedSearchInit', 'RelatedPaginateInit', 'Prompt', 'ProcessErrors', 'RelatedSearchInit', 'RelatedPaginateInit', 'Prompt',
'ClearScope', 'GetBasePath', 'Wait', '$state' 'ClearScope', 'GetBasePath', 'Wait', 'Stream', '$state'
]; ];

View File

@@ -57,4 +57,6 @@
</div> </div>
</div> </div>
</div> </div>
</div> <div id="pagination-container" ng-hide="organization_num_pages < 2">
</div>
</div>