mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 03:10:42 -03:30
Portal mode pagination
fixed the pagination on the job templates portal widget. To fix this i had to include an '&' in the pagination url creation in paginationhelpers.js. not sure if this could have effect on anything else that uses pagination.
This commit is contained in:
parent
2916ebf0c0
commit
300fb677fa
@ -35,6 +35,7 @@ function PortalController($scope, $compile, $routeParams, $rootScope, $location,
|
||||
list = PortalJobTemplateList,
|
||||
view= GenerateList,
|
||||
defaultUrl = GetBasePath('job_templates'),
|
||||
max_rows,
|
||||
buttons = {
|
||||
refresh: {
|
||||
mode: 'all',
|
||||
@ -79,6 +80,7 @@ function PortalController($scope, $compile, $routeParams, $rootScope, $location,
|
||||
searchSize: 'col-lg-6 col-md-6'
|
||||
});
|
||||
|
||||
$scope.job_templatePageSize = $scope.getMaxRows();
|
||||
|
||||
SearchInit({
|
||||
scope: $scope,
|
||||
@ -89,16 +91,10 @@ function PortalController($scope, $compile, $routeParams, $rootScope, $location,
|
||||
PaginateInit({
|
||||
scope: $scope,
|
||||
list: list,
|
||||
url: defaultUrl
|
||||
url: defaultUrl,
|
||||
pageSize: $scope.job_templatePageSize
|
||||
});
|
||||
|
||||
// Called from Inventories tab, host failed events link:
|
||||
if ($routeParams.name) {
|
||||
$scope[list.iterator + 'SearchField'] = 'name';
|
||||
$scope[list.iterator + 'SearchValue'] = $routeParams.name;
|
||||
$scope[list.iterator + 'SearchFieldLabel'] = list.fields.name.label;
|
||||
}
|
||||
|
||||
$scope.search(list.iterator);
|
||||
|
||||
PortalJobsWidget({
|
||||
@ -126,22 +122,53 @@ function PortalController($scope, $compile, $routeParams, $rootScope, $location,
|
||||
jobs_scope.search('portal_job'); //processEvent(event);
|
||||
});
|
||||
|
||||
$scope.getMaxRows = function(){
|
||||
var docw = $(window).width(),
|
||||
box_height, available_height, search_row, page_row, height, header, row_height;
|
||||
|
||||
available_height = Math.floor($(window).height() - $('#main-menu-container .navbar').outerHeight() - $('#refresh-row').outerHeight() - 35);
|
||||
$('.portal-job-template-container').height(available_height);
|
||||
$('.portal-container').height(available_height);
|
||||
search_row = Math.max($('.search-row:eq(0)').outerHeight(), 50);
|
||||
page_row = Math.max($('.page-row:eq(0)').outerHeight(), 33);
|
||||
header = 0; //Math.max($('#completed_jobs_table thead').height(), 41);
|
||||
height = Math.floor(available_height) - header - page_row - search_row ;
|
||||
if (docw < 765 && docw >= 493) {
|
||||
row_height = 27;
|
||||
}
|
||||
else if (docw < 493) {
|
||||
row_height = 47;
|
||||
}
|
||||
else if (docw < 865) {
|
||||
row_height = 87;
|
||||
}
|
||||
else if (docw < 925) {
|
||||
row_height = 67;
|
||||
}
|
||||
else if (docw < 1415) {
|
||||
row_height = 47;
|
||||
}
|
||||
else {
|
||||
row_height = 35;
|
||||
}
|
||||
max_rows = Math.floor(height / row_height);
|
||||
if (max_rows < 5){
|
||||
box_height = header+page_row + search_row + 40 + (5 * row_height);
|
||||
if (docw < 1140) {
|
||||
box_height += 40;
|
||||
}
|
||||
// $('.portal-job-template-container').height(box_height);
|
||||
max_rows = 5;
|
||||
}
|
||||
return max_rows;
|
||||
};
|
||||
|
||||
$scope.submitJob = function (id) {
|
||||
PlaybookRun({ scope: $scope, id: id });
|
||||
};
|
||||
|
||||
$scope.refresh = function () {
|
||||
$scope.$emit('LoadPortal');
|
||||
// Wait('start');
|
||||
// loadedCount = 0;
|
||||
// Rest.setUrl(GetBasePath('dashboard'));
|
||||
// Rest.get()
|
||||
// .success(function (data) {
|
||||
// $scope.$emit('dashboardReady', data);
|
||||
// })
|
||||
// .error(function (data, status) {
|
||||
// ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to get dashboard: ' + status });
|
||||
// });
|
||||
};
|
||||
|
||||
$scope.refresh();
|
||||
|
||||
@ -138,7 +138,7 @@ angular.module('PaginationHelpers', ['Utilities', 'RefreshHelper', 'RefreshRelat
|
||||
connect = (/\/$/.test(new_url)) ? '?' : '&';
|
||||
new_url += connect + 'page=' + page;
|
||||
new_url += (scope[iterator + 'SearchParams']) ? '&' + scope[iterator + 'SearchParams'] +
|
||||
'&page_size=' + scope[iterator + '_page_size'] : 'page_size=' + scope[iterator + 'PageSize'];
|
||||
'&page_size=' + scope[iterator + '_page_size'] : '&page_size=' + scope[iterator + 'PageSize'];
|
||||
Wait('start');
|
||||
Refresh({ scope: scope, set: set, iterator: iterator, url: new_url });
|
||||
};
|
||||
|
||||
@ -11,8 +11,8 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('PortalJobsWidget', ['RestServices', 'Utilities'])
|
||||
.factory('PortalJobsWidget', ['$rootScope', '$compile', 'LoadSchedulesScope', 'LoadJobsScope', 'PortalJobsList', 'ScheduledJobsList', 'GetChoices', 'GetBasePath',
|
||||
function ($rootScope, $compile, LoadSchedulesScope, LoadJobsScope, PortalJobsList, ScheduledJobsList, GetChoices, GetBasePath) {
|
||||
.factory('PortalJobsWidget', ['$rootScope', '$compile', 'LoadSchedulesScope', 'LoadJobsScope', 'PortalJobsList', 'ScheduledJobsList', 'GetChoices', 'GetBasePath', 'PortalJobTemplateList',
|
||||
function ($rootScope, $compile, LoadSchedulesScope, LoadJobsScope, PortalJobsList, ScheduledJobsList, GetChoices, GetBasePath, PortalJobTemplateList) {
|
||||
return function (params) {
|
||||
var scope = params.scope,
|
||||
target = params.target,
|
||||
@ -70,6 +70,7 @@ angular.module('PortalJobsWidget', ['RestServices', 'Utilities'])
|
||||
});
|
||||
|
||||
|
||||
|
||||
$(window).resize(_.debounce(function() {
|
||||
resizePortalJobsWidget();
|
||||
}, 500));
|
||||
@ -150,8 +151,9 @@ angular.module('PortalJobsWidget', ['RestServices', 'Utilities'])
|
||||
setPortalJobsHeight();
|
||||
jobs_scope[PortalJobsList.iterator + '_page_size'] = max_rows;
|
||||
jobs_scope.changePageSize(PortalJobsList.name, PortalJobsList.iterator, false);
|
||||
// scheduled_scope[ScheduledJobsList.iterator + '_page_size'] = max_rows;
|
||||
// scheduled_scope.changePageSize(ScheduledJobsList.name, ScheduledJobsList.iterator, false);
|
||||
scope[PortalJobTemplateList.iterator + '_page_size'] = max_rows;
|
||||
scope[PortalJobTemplateList.iterator + 'PageSize'] = max_rows;
|
||||
scope.changePageSize(PortalJobTemplateList.name, PortalJobTemplateList.iterator, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -205,7 +205,7 @@
|
||||
<a id="mobile_munin" target="_blank" ng-show="user_is_superuser" href="/munin" ng-hide="portalMode===true">Monitor Tower</a></li>
|
||||
<a href="#portal" id="mobile_portal_link" ng-hide="portalMode===true">Portal Mode</a></li>
|
||||
<a href="" id="mobile_view_license" ng-click="viewLicense()" ng-hide="portalMode===true">View License</a></li>
|
||||
<a href="" id="mobile_view_leave_portal" ng-click="leavePortal()" ng-show="portalMode===true">Exit Portal Mode</a></li>
|
||||
<a href="" id="mobile_view_leave_portal" ng-click="leavePortal()" ng-show="portalMode===true">Exit Portal</a></li>
|
||||
<a href="#/logout" id="mobile_logout">Logout</a>
|
||||
</nav>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user