From 2ba0319e79bc71b3684268b907ff50856a013dae Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Wed, 25 Jul 2018 19:59:44 -0400 Subject: [PATCH] handle finished job run with incomplete status info --- awx/ui/client/features/output/details.component.js | 14 +++++++++++--- awx/ui/client/features/output/output.strings.js | 1 + awx/ui/client/features/output/stats.partial.html | 2 +- awx/ui/client/features/output/status.service.js | 13 +++++++++++-- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/awx/ui/client/features/output/details.component.js b/awx/ui/client/features/output/details.component.js index 0417246e8e..b1cc4734cd 100644 --- a/awx/ui/client/features/output/details.component.js +++ b/awx/ui/client/features/output/details.component.js @@ -26,10 +26,18 @@ function getStatusDetails (jobStatus) { } const choices = mapChoices(resource.model.options('actions.GET.status.choices')); - const label = strings.get('labels.STATUS'); - const icon = `fa icon-job-${unmapped}`; - const value = choices[unmapped]; + + let icon; + let value; + + if (unmapped === 'unknown') { + icon = 'fa icon-job-pending'; + value = strings.get('details.UNKNOWN'); + } else { + icon = `fa icon-job-${unmapped}`; + value = choices[unmapped]; + } return { label, icon, value }; } diff --git a/awx/ui/client/features/output/output.strings.js b/awx/ui/client/features/output/output.strings.js index ec22a76d7c..6903a10d5f 100644 --- a/awx/ui/client/features/output/output.strings.js +++ b/awx/ui/client/features/output/output.strings.js @@ -37,6 +37,7 @@ function OutputStrings (BaseString) { NOT_STARTED: t.s('Not Started'), SHOW_LESS: t.s('Show Less'), SHOW_MORE: t.s('Show More'), + UNKNOWN: t.s('Finished'), }; ns.labels = { diff --git a/awx/ui/client/features/output/stats.partial.html b/awx/ui/client/features/output/stats.partial.html index c04df0d8d0..fa27beb97b 100644 --- a/awx/ui/client/features/output/stats.partial.html +++ b/awx/ui/client/features/output/stats.partial.html @@ -10,7 +10,7 @@ {{:: vm.strings.get('stats.HOSTS')}} ... - {{ vm.hosts || 0 }} + {{ vm.hosts || 1 }} {{:: vm.strings.get('stats.ELAPSED') }} ... diff --git a/awx/ui/client/features/output/status.service.js b/awx/ui/client/features/output/status.service.js index d7b74d2279..a8b5d6ee8e 100644 --- a/awx/ui/client/features/output/status.service.js +++ b/awx/ui/client/features/output/status.service.js @@ -5,7 +5,7 @@ const PLAY_START = 'playbook_on_play_start'; const TASK_START = 'playbook_on_task_start'; const HOST_STATUS_KEYS = ['dark', 'failures', 'changed', 'ok', 'skipped']; -const COMPLETE = ['successful', 'failed']; +const COMPLETE = ['successful', 'failed', 'unknown']; const INCOMPLETE = ['canceled', 'error']; const UNSUCCESSFUL = ['failed'].concat(INCOMPLETE); const FINISHED = COMPLETE.concat(INCOMPLETE); @@ -26,10 +26,11 @@ function JobStatusService (moment, message) { this.state = { running: false, + anyFailed: false, counts: { plays: 0, tasks: 0, - hosts: 0, + hosts: 1, }, hosts: {}, status: model.get('status'), @@ -124,6 +125,10 @@ function JobStatusService (moment, message) { changed = true; } + if (data.failed) { + this.state.anyFailed = true; + } + if (changed) { this.dispatch(); } @@ -149,6 +154,10 @@ function JobStatusService (moment, message) { } else { this.setJobStatus('successful'); } + } else if (this.state.counter > -1) { + this.setJobStatus(this.state.anyFailed ? 'failed' : 'unknown'); + } else { + this.setJobStatus('unknown'); } };