1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 01:21:21 +03:00

Jobs page- schedules layout now works with new page layout. Refined page auto-resize.

This commit is contained in:
Chris Houseknecht 2014-05-05 10:51:37 -04:00
parent 808b82bd33
commit 80fbe0b525
6 changed files with 52 additions and 34 deletions

View File

@ -358,7 +358,8 @@ function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, $routeP
choicesCount = 0;
CallbackHelpInit({ scope: $scope });
SchedulesList.well = false;
generator.inject(form, { mode: 'edit', related: true, scope: $scope });
$scope.parseType = 'yaml';

View File

@ -129,25 +129,18 @@ function JobsListController ($scope, $compile, ClearScope, Breadcrumbs, LoadBrea
var docw = $(document).width(),
available_height,
search_row, page_row, height, header, row_height, rows;
if (docw > 1240) {
// customize the container height and # of rows based on available viewport height
available_height = $('#wrap').height() - $('#main_tabs').height() - $('#breadcrumbs').outerHeight() - $('.site-footer').outerHeight() - 15;
available_height = $(window).height() - $('.main-menu').outerHeight() - $('#main_tabs').outerHeight() - $('#breadcrumbs').outerHeight() - $('.site-footer').outerHeight() - 25;
$('.jobs-list-container').each(function() {
$(this).height(Math.floor(available_height / 2));
});
search_row = $('.search-row:eq(0)').outerHeight();
page_row = $('.page-row:eq(0)').outerHeight();
header = $('#completed_jobs_table thead').height();
height = Math.floor(available_height / 2) - header - page_row - search_row;
height = Math.floor(available_height / 2) - header - page_row - search_row - 15;
row_height = $('.jobs-list-container tbody tr:eq(0)').height();
rows = Math.floor(height / row_height);
completed_scope[CompletedJobsList.iterator + '_page_size'] = rows;
completed_scope.changePageSize(CompletedJobsList.name, CompletedJobsList.iterator);
running_scope[RunningJobsList.iterator + '_page_size'] = rows;
running_scope.changePageSize(RunningJobsList.name, RunningJobsList.iterator);
queued_scope[QueuedJobsList.iterator + '_page_size'] = rows;
queued_scope.changePageSize(QueuedJobsList.name, QueuedJobsList.iterator);
}
else {
// when width < 1240px put things back to their default state
@ -155,13 +148,15 @@ function JobsListController ($scope, $compile, ClearScope, Breadcrumbs, LoadBrea
$(this).css({ 'height': 'auto' });
});
rows = 5;
completed_scope[CompletedJobsList.iterator + '_page_size'] = rows;
completed_scope.changePageSize(CompletedJobsList.name, CompletedJobsList.iterator);
running_scope[RunningJobsList.iterator + '_page_size'] = rows;
running_scope.changePageSize(RunningJobsList.name, RunningJobsList.iterator);
queued_scope[QueuedJobsList.iterator + '_page_size'] = rows;
queued_scope.changePageSize(QueuedJobsList.name, QueuedJobsList.iterator);
}
completed_scope[CompletedJobsList.iterator + '_page_size'] = rows;
completed_scope.changePageSize(CompletedJobsList.name, CompletedJobsList.iterator);
running_scope[RunningJobsList.iterator + '_page_size'] = rows;
running_scope.changePageSize(RunningJobsList.name, RunningJobsList.iterator);
queued_scope[QueuedJobsList.iterator + '_page_size'] = rows;
queued_scope.changePageSize(QueuedJobsList.name, QueuedJobsList.iterator);
scheduled_scope[ScheduledJobsList.iterator + '_page_size'] = rows;
scheduled_scope.changePageSize(ScheduledJobsList.name, ScheduledJobsList.iterator);
}
}

View File

@ -43,7 +43,7 @@ GetBasePath, Wait, Breadcrumbs, Find, LoadDialogPartial, LoadSchedulesScope, Get
$compile(e)($scope);
url += "schedules/";
SchedulesList.well = true;
LoadSchedulesScope({
parent_scope: $scope,
scope: $scope,

View File

@ -9,7 +9,8 @@
'use strict';
angular.module('SchedulesHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', 'SearchHelper', 'PaginationHelpers', 'ListGenerator', 'ModalDialog' ])
angular.module('SchedulesHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', 'SearchHelper', 'PaginationHelpers', 'ListGenerator', 'ModalDialog',
'GeneratorHelpers'])
.factory('ShowSchedulerModal', ['Wait', 'CreateDialog', function(Wait, CreateDialog) {
return function(params) {
@ -541,24 +542,46 @@ angular.module('SchedulesHelper', [ 'Utilities', 'RestServices', 'SchedulesHelpe
* Called from a controller to setup the scope for a schedules list
*
*/
.factory('LoadSchedulesScope', ['$routeParams','SearchInit', 'PaginateInit', 'GenerateList', 'SchedulesControllerInit', 'SchedulesListInit',
function($routeParams, SearchInit, PaginateInit, GenerateList, SchedulesControllerInit, SchedulesListInit) {
.factory('LoadSchedulesScope', ['$compile', '$location', '$routeParams','SearchInit', 'PaginateInit', 'GenerateList', 'SchedulesControllerInit',
'SchedulesListInit', 'SearchWidget',
function($compile, $location, $routeParams, SearchInit, PaginateInit, GenerateList, SchedulesControllerInit, SchedulesListInit, SearchWidget) {
return function(params) {
var parent_scope = params.parent_scope,
scope = params.scope,
list = params.list,
id = params.id,
url = params.url,
pageSize = params.pageSize || 5;
pageSize = params.pageSize || 5,
base = $location.path().replace(/^\//, '').split('/')[0],
e, html;
GenerateList.inject(list, {
mode: 'edit',
id: id,
breadCrumbs: false,
scope: scope,
searchSize: 'col-lg-4 col-md-6 col-sm-12 col-xs-12',
showSearch: true
});
if (base === 'jobs') {
// on jobs page the search widget appears on the right
html = SearchWidget({
iterator: list.iterator,
template: params.list,
includeSize: false
});
e = angular.element(document.getElementById(id + '-search-container')).append(html);
$compile(e)(scope);
GenerateList.inject(list, {
mode: 'edit',
id: id,
breadCrumbs: false,
scope: scope,
showSearch: false
});
}
else {
GenerateList.inject(list, {
mode: 'edit',
id: id,
breadCrumbs: false,
scope: scope,
searchSize: 'col-lg-4 col-md-6 col-sm-12 col-xs-12',
showSearch: true
});
}
SearchInit({
scope: scope,

View File

@ -15,7 +15,7 @@ angular.module('SchedulesListDefinition', [])
iterator: 'schedule',
selectTitle: '',
editTitle: 'Schedules',
well: true,
well: false,
index: true,
hover: true,
@ -46,9 +46,8 @@ angular.module('SchedulesListDefinition', [])
},
id: {
label: 'ID',
key: true,
desc: true,
searchType: 'int'
searchType: 'int',
searchOnly: true
}
},

View File

@ -740,7 +740,7 @@ select.page-size {
/* breadcrumbs */
.nav-path {
padding: 5px 0 10px 0;
margin-right: 5px;
margin-right: 2px;
margin-bottom: 20px;
font-size: 14px;
font-weight: bold;