From bfc8f892054dbb95a8d7362d93928b77028f1a49 Mon Sep 17 00:00:00 2001 From: Chris Houseknecht Date: Thu, 10 Jul 2014 13:15:07 -0400 Subject: [PATCH] Job detail page re-refactor Fixed host link on event viewer and tooltip on dialog. Tightened up job tab page row calculation. It now assumes rows will not hit 47px height until width drops to below 1350px. --- awx/ui/static/js/controllers/Jobs.js | 9 ++++++--- awx/ui/static/js/helpers/EventViewer.js | 10 +++++----- awx/ui/static/lib/ansible/form-generator.js | 10 ++++++---- awx/ui/static/partials/job_detail.html | 2 +- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/awx/ui/static/js/controllers/Jobs.js b/awx/ui/static/js/controllers/Jobs.js index 8ba3cb25cd..80b2ee7286 100644 --- a/awx/ui/static/js/controllers/Jobs.js +++ b/awx/ui/static/js/controllers/Jobs.js @@ -10,7 +10,7 @@ 'use strict'; -function JobsListController ($scope, $compile, $routeParams, ClearScope, Breadcrumbs, LoadBreadCrumbs, LoadSchedulesScope, LoadJobsScope, RunningJobsList, CompletedJobsList, QueuedJobsList, +function JobsListController ($log, $scope, $compile, $routeParams, ClearScope, Breadcrumbs, LoadBreadCrumbs, LoadSchedulesScope, LoadJobsScope, RunningJobsList, CompletedJobsList, QueuedJobsList, ScheduledJobsList, GetChoices, GetBasePath, Wait, Socket) { ClearScope(); @@ -234,9 +234,11 @@ function JobsListController ($scope, $compile, $routeParams, ClearScope, Breadcr //doch = $(window).height(), available_height, search_row, page_row, height, header, row_height; + $log.debug('docw: ' + docw); if (docw > 1200) { // customize the container height and # of rows based on available viewport height available_height = $(window).height() - $('#main-menu-container .navbar').outerHeight() - 80; + $log.debug('available_height: ' + available_height); $('.jobs-list-container').each(function() { $(this).height(Math.floor(available_height / 2)); }); @@ -244,7 +246,7 @@ function JobsListController ($scope, $compile, $routeParams, ClearScope, Breadcr page_row = Math.max($('.page-row:eq(0)').outerHeight(), 33); header = Math.max($('#completed_jobs_table thead').height(), 24); height = Math.floor(available_height / 2) - header - page_row - search_row - 30; - row_height = (docw < 1415) ? 47 : 27; + row_height = (docw < 1350) ? 47 : 27; max_rows = Math.floor(height / row_height); } else { @@ -254,6 +256,7 @@ function JobsListController ($scope, $compile, $routeParams, ClearScope, Breadcr }); max_rows = 5; } + $log.debug('max_rows: ' + max_rows); } // Set container height and return the number of allowed rows @@ -270,7 +273,7 @@ function JobsListController ($scope, $compile, $routeParams, ClearScope, Breadcr } } -JobsListController.$inject = [ '$scope', '$compile', '$routeParams', 'ClearScope', 'Breadcrumbs', 'LoadBreadCrumbs', 'LoadSchedulesScope', 'LoadJobsScope', 'RunningJobsList', 'CompletedJobsList', +JobsListController.$inject = [ '$log', '$scope', '$compile', '$routeParams', 'ClearScope', 'Breadcrumbs', 'LoadBreadCrumbs', 'LoadSchedulesScope', 'LoadJobsScope', 'RunningJobsList', 'CompletedJobsList', 'QueuedJobsList', 'ScheduledJobsList', 'GetChoices', 'GetBasePath', 'Wait', 'Socket' ]; function JobsEdit($scope, $rootScope, $compile, $location, $log, $routeParams, JobForm, JobTemplateForm, GenerateForm, Rest, diff --git a/awx/ui/static/js/helpers/EventViewer.js b/awx/ui/static/js/helpers/EventViewer.js index 065fb30933..2e336fda59 100644 --- a/awx/ui/static/js/helpers/EventViewer.js +++ b/awx/ui/static/js/helpers/EventViewer.js @@ -7,7 +7,7 @@ 'use strict'; -angular.module('EventViewerHelper', ['ModalDialog', 'Utilities', 'EventsViewerFormDefinition']) +angular.module('EventViewerHelper', ['ModalDialog', 'Utilities', 'EventsViewerFormDefinition', 'HostsHelper']) .factory('EventViewer', ['$compile', 'CreateDialog', 'GetEvent', 'Wait', 'EventAddTable', 'GetBasePath', 'LookUpName', 'Empty', 'EventAddPreFormattedText', function($compile, CreateDialog, GetEvent, Wait, EventAddTable, GetBasePath, LookUpName, Empty, EventAddPreFormattedText) { @@ -225,10 +225,10 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities', 'EventsViewerFo html += $filter('date')(obj[key], 'MM/dd/yy HH:mm:ss'); } } - else if (key === "host_name") { - html += "" + obj[key] + ""; + else if (key === "host_name" && obj.host_id) { + html += "" + obj[key] + ""; } else { html += obj[key]; diff --git a/awx/ui/static/lib/ansible/form-generator.js b/awx/ui/static/lib/ansible/form-generator.js index c04ad5ec5c..db3356343d 100644 --- a/awx/ui/static/lib/ansible/form-generator.js +++ b/awx/ui/static/lib/ansible/form-generator.js @@ -38,7 +38,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'Utilities', 'ListGenerator // Returns scope of form. // - var element, fld, set, show; + var element, fld, set, show, self = this; if (options.modal) { if (options.modal_body_id) { @@ -190,13 +190,15 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'Utilities', 'ListGenerator }); } - if (!this.scope.$$phase) { + if (self.scope && !self.scope.$$phase) { setTimeout(function() { - this.scope.$digest(); + if (self.scope) { + self.scope.$digest(); + } }, 100); } - return this.scope; + return self.scope; }, diff --git a/awx/ui/static/partials/job_detail.html b/awx/ui/static/partials/job_detail.html index 9c9a99caee..73814c452f 100644 --- a/awx/ui/static/partials/job_detail.html +++ b/awx/ui/static/partials/job_detail.html @@ -311,7 +311,7 @@ {{ host.changed }} {{ host.unreachable }} {{ host.failed }} - + No matching hosts