mirror of
https://github.com/ansible/awx.git
synced 2026-01-17 20:51:21 -03:30
#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:
parent
1bcc3b9269
commit
4ade498c6c
@ -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();
|
||||
|
||||
@ -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'
|
||||
];
|
||||
@ -57,4 +57,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="pagination-container" ng-hide="organization_num_pages < 2">
|
||||
</div>
|
||||
</div>
|
||||
Loading…
x
Reference in New Issue
Block a user