From 3516ad4b9803fe2a5383b30b73a9b6923e72552b Mon Sep 17 00:00:00 2001 From: Chris Houseknecht Date: Wed, 25 Jun 2014 16:24:30 -0400 Subject: [PATCH] Job detail page refactor Re-enabling a count of the possible hosts that should report status on each task. As live events happen increment a count stored on the play. Only increment when hosts are reporting for the first task of the play, and only increment if the host status is in: successful, changed, skipped or failed. Added the total to the plays list as 'Reporting Hosts'. --- awx/ui/static/js/controllers/JobDetail.js | 22 +++++++++++++----- awx/ui/static/js/helpers/JobDetail.js | 12 +++++----- awx/ui/static/less/main-layout.less | 1 + awx/ui/static/partials/job_detail.html | 28 ++++++++++++----------- 4 files changed, 38 insertions(+), 25 deletions(-) diff --git a/awx/ui/static/js/controllers/JobDetail.js b/awx/ui/static/js/controllers/JobDetail.js index ca8ac56398..9687c67057 100644 --- a/awx/ui/static/js/controllers/JobDetail.js +++ b/awx/ui/static/js/controllers/JobDetail.js @@ -308,7 +308,7 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log, scope.activePlay = data.results[0].id; } data.results.forEach(function(event, idx) { - var status, start, end, elapsed; + var status, start, end, elapsed, ok, changed, failed, skipped; status = (event.failed) ? 'failed' : (event.changed) ? 'changed' : 'successful'; start = event.started; @@ -344,12 +344,19 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log, tasks: {} }; - scope.host_summary.ok += (data.ok_count) ? data.ok_count : 0; - scope.host_summary.changed += (data.changed_count) ? data.changed_count : 0; + ok = (data.ok_count) ? data.ok_count : 0; + changed = (data.changed_count) ? data.changed_count : 0; + failed = (data.failed_count) ? data.failed_count : 0; + skipped = (data.skipped_count) ? data.skipped_count : 0; + + scope.jobData.plays[event.id].hostCount = ok + changed + failed + skipped; + + scope.host_summary.ok += ok; + scope.host_summary.changed += changed; scope.host_summary.unreachable += (data.unreachable_count) ? data.unreachable_count : 0; - scope.host_summary.failed += (data.failed_count) ? data.failed_count : 0; - scope.host_summary.total = scope.host_summary.ok + scope.host_summary.changed + - scope.host_summary.unreachable + scope.host_summary.failed; + scope.host_summary.failed += failed; + scope.host_summary.total = scope.host_summary.ok + scope.host_summary.changed + scope.host_summary.unreachable + + scope.host_summary.failed; }); if (scope.activePlay) { scope.jobData.plays[scope.activePlay].playActiveClass = 'active'; @@ -523,6 +530,9 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log, setTimeout(function() { $('#job-summary-container .job_well').height($('#job-detail-container').height() - 18); }, 500); $('#job-summary-container').show(); } + + scope.lessStatus = true; // close the view more status option + // Detail table height adjusting. First, put page height back to 'normal'. $('#plays-table-detail').height(80); $('#plays-table-detail').mCustomScrollbar("update"); diff --git a/awx/ui/static/js/helpers/JobDetail.js b/awx/ui/static/js/helpers/JobDetail.js index 917d6ae817..4ea6fd265a 100644 --- a/awx/ui/static/js/helpers/JobDetail.js +++ b/awx/ui/static/js/helpers/JobDetail.js @@ -239,7 +239,7 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge hostResults: {} }; - if (!scope.jobData.plays[scope.activePlay].firstTask) { + if (scope.jobData.plays[scope.activePlay].firstTask === undefined || scope.jobData.plays[scope.activePlay].firstTask === null) { scope.jobData.plays[scope.activePlay].firstTask = event.id; } @@ -458,10 +458,10 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge if (scope.jobData.plays[scope.activePlay].tasks[task_id] !== undefined) { task = scope.jobData.plays[scope.activePlay].tasks[task_id]; - //if (task_id === scope.jobData.plays[scope.activePlay].firstTask) { - // scope.jobData.plays[scope.activePlay].hostCount++; - // task.hostCount++; - //} + if (task_id === scope.jobData.plays[scope.activePlay].firstTask && status !== 'unreachable') { + scope.jobData.plays[scope.activePlay].hostCount++; + task.hostCount++; + } task.reportedHosts += 1; task.failedCount += (status === 'failed' || status === 'unreachable') ? 1 : 0; @@ -481,7 +481,7 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge diff; //task = scope.jobData.plays[scope.activePlay].tasks[task_id]; - task.hostCount = task.failedCount + task.changedCount + task.skippedCount + task.successfulCount; + //task.hostCount = task.failedCount + task.changedCount + task.skippedCount + task.successfulCount; task.failedPct = (task.hostCount > 0) ? Math.ceil((100 * (task.failedCount / task.hostCount))) : 0; task.changedPct = (task.hostCount > 0) ? Math.ceil((100 * (task.changedCount / task.hostCount))) : 0; task.skippedPct = (task.hostCount > 0) ? Math.ceil((100 * (task.skippedCount / task.hostCount))) : 0; diff --git a/awx/ui/static/less/main-layout.less b/awx/ui/static/less/main-layout.less index 8656a3453e..d8539f97b2 100644 --- a/awx/ui/static/less/main-layout.less +++ b/awx/ui/static/less/main-layout.less @@ -60,6 +60,7 @@ body { #account-submenu { margin-right: 5px; } + @media (max-width: 1075px) { #main-menu-container { diff --git a/awx/ui/static/partials/job_detail.html b/awx/ui/static/partials/job_detail.html index fc00b67e78..a808473633 100644 --- a/awx/ui/static/partials/job_detail.html +++ b/awx/ui/static/partials/job_detail.html @@ -23,15 +23,15 @@
- -
+ +
{{ job_status.status }} {{ job_status.explanation }}
- -
+ +
{{ job_status.started | date:'MM/dd/yy HH:mm:ss' }}
Finished  {{ job_status.finished | date:'MM/dd/yy HH:mm:ss' }}
Elapsed  {{ job_status.elapsed }}
@@ -39,22 +39,22 @@
- -
- -
+ +
- -
+ +
@@ -77,7 +77,8 @@
-
Name
+
Name
+
@@ -87,10 +88,11 @@ -
+
{{ play.name }}
+