mirror of
https://github.com/ansible/awx.git
synced 2026-05-13 12:27:37 -02: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:
@@ -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();
|
||||||
|
|||||||
@@ -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'
|
||||||
];
|
];
|
||||||
@@ -57,4 +57,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div id="pagination-container" ng-hide="organization_num_pages < 2">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user