From 74c5236da2b6e054c9dd468a4aa1ab2d54a7cb88 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Fri, 14 Aug 2015 13:08:33 -0700 Subject: [PATCH] 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,