From 74c5236da2b6e054c9dd468a4aa1ab2d54a7cb88 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Fri, 14 Aug 2015 13:08:33 -0700 Subject: [PATCH 1/3] Organize host summary results by host id instead of name on the job detail page as host results were stored in the hostSummaries array, they were organized by hostname, but hostname can be changed as a result of the playbook potentially --- awx/ui/client/src/controllers/JobDetail.js | 2 +- awx/ui/client/src/helpers/JobDetail.js | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/awx/ui/client/src/controllers/JobDetail.js b/awx/ui/client/src/controllers/JobDetail.js index 169712ba8d..8d9cd28e6a 100644 --- a/awx/ui/client/src/controllers/JobDetail.js +++ b/awx/ui/client/src/controllers/JobDetail.js @@ -298,7 +298,7 @@ export function JobDetailController ($location, $rootScope, $filter, $scope, $co else { name = ""; } - scope.jobData.hostSummaries[name] = { + scope.jobData.hostSummaries[event.host] = { id: event.host, name: name, ok: event.ok, diff --git a/awx/ui/client/src/helpers/JobDetail.js b/awx/ui/client/src/helpers/JobDetail.js index ba99bc4d10..538110aca8 100644 --- a/awx/ui/client/src/helpers/JobDetail.js +++ b/awx/ui/client/src/helpers/JobDetail.js @@ -497,18 +497,18 @@ export default scope.host_summary.failed; */ - if (scope.jobData.hostSummaries[name] !== undefined) { - scope.jobData.hostSummaries[name].ok += (status === 'successful') ? 1 : 0; - scope.jobData.hostSummaries[name].changed += (status === 'changed') ? 1 : 0; - scope.jobData.hostSummaries[name].unreachable += (status === 'unreachable') ? 1 : 0; - scope.jobData.hostSummaries[name].failed += (status === 'failed') ? 1 : 0; + if (scope.jobData.hostSummaries[host_id] !== undefined) { + scope.jobData.hostSummaries[host_id].ok += (status === 'successful') ? 1 : 0; + scope.jobData.hostSummaries[host_id].changed += (status === 'changed') ? 1 : 0; + scope.jobData.hostSummaries[host_id].unreachable += (status === 'unreachable') ? 1 : 0; + scope.jobData.hostSummaries[host_id].failed += (status === 'failed') ? 1 : 0; if (status === 'failed' || status === 'unreachable') { scope.jobData.hostSummaries[name].status = 'failed'; } } else { - scope.jobData.hostSummaries[name] = { - id: name, + scope.jobData.hostSummaries[host_id] = { + id: host_id, name: name, ok: (status === 'successful') ? 1 : 0, changed: (status === 'changed') ? 1 : 0, From ed85df52f0836f140d9a5dce1940767375551aba Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Fri, 14 Aug 2015 13:10:15 -0700 Subject: [PATCH 2/3] Job detail page: increment hostCount if missing occassionally the hostCount will not get incremented despite a host result being processed as successful, failed, skipped, unreachable, or changed. This cause the UI not to show the host status --- awx/ui/client/src/helpers/JobDetail.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/awx/ui/client/src/helpers/JobDetail.js b/awx/ui/client/src/helpers/JobDetail.js index 538110aca8..3977c26bb9 100644 --- a/awx/ui/client/src/helpers/JobDetail.js +++ b/awx/ui/client/src/helpers/JobDetail.js @@ -658,7 +658,12 @@ export default var task = params.task, diff; - task.missingCount = task.hostCount - (task.failedCount + task.changedCount + task.skippedCount + task.successfulCount + task.unreachableCount); + task.missingCount = task.hostCount - (task.failedCount + task.changedCount + task.skippedCount + task.successfulCount + + task.unreachableCount); + if(task.missingCount<0){ + task.hostCount = (task.failedCount + task.changedCount + task.skippedCount + task.successfulCount + + task.unreachableCount); + } task.missingPct = (task.hostCount > 0) ? Math.ceil((100 * (task.missingCount / task.hostCount))) : 0; 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; From a8a78b39141556570104db8638352fce1cc6f03c Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Mon, 17 Aug 2015 14:55:18 -0700 Subject: [PATCH 3/3] Organize host events by host id missed this in the original PR --- awx/ui/client/src/helpers/JobDetail.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/awx/ui/client/src/helpers/JobDetail.js b/awx/ui/client/src/helpers/JobDetail.js index 3977c26bb9..3e54f37a5d 100644 --- a/awx/ui/client/src/helpers/JobDetail.js +++ b/awx/ui/client/src/helpers/JobDetail.js @@ -3,7 +3,7 @@ * * All Rights Reserved *************************************************/ - + /** * @ngdoc function * @name helpers.function:JobDetail @@ -503,7 +503,7 @@ export default scope.jobData.hostSummaries[host_id].unreachable += (status === 'unreachable') ? 1 : 0; scope.jobData.hostSummaries[host_id].failed += (status === 'failed') ? 1 : 0; if (status === 'failed' || status === 'unreachable') { - scope.jobData.hostSummaries[name].status = 'failed'; + scope.jobData.hostSummaries[host_id].status = 'failed'; } } else {