diff --git a/awx/ui/static/js/controllers/Portal.js b/awx/ui/static/js/controllers/Portal.js
index 95bdc98b14..035c62fb97 100644
--- a/awx/ui/static/js/controllers/Portal.js
+++ b/awx/ui/static/js/controllers/Portal.js
@@ -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();
diff --git a/awx/ui/static/js/helpers/PaginationHelpers.js b/awx/ui/static/js/helpers/PaginationHelpers.js
index f1d25531a2..87ac589aad 100644
--- a/awx/ui/static/js/helpers/PaginationHelpers.js
+++ b/awx/ui/static/js/helpers/PaginationHelpers.js
@@ -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 });
};
diff --git a/awx/ui/static/js/widgets/PortalJobs.js b/awx/ui/static/js/widgets/PortalJobs.js
index 84d17a51d9..dddfde7a45 100644
--- a/awx/ui/static/js/widgets/PortalJobs.js
+++ b/awx/ui/static/js/widgets/PortalJobs.js
@@ -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);
}
diff --git a/awx/ui/templates/ui/index.html b/awx/ui/templates/ui/index.html
index b695b1dce3..1f8604ffdb 100644
--- a/awx/ui/templates/ui/index.html
+++ b/awx/ui/templates/ui/index.html
@@ -205,7 +205,7 @@
Monitor Tower
Portal Mode
View License
- Exit Portal Mode
+ Exit Portal
Logout