diff --git a/awx/ui/client/src/helpers/JobDetail.js b/awx/ui/client/src/helpers/JobDetail.js index df42b50328..1e7f5d89e7 100644 --- a/awx/ui/client/src/helpers/JobDetail.js +++ b/awx/ui/client/src/helpers/JobDetail.js @@ -784,7 +784,6 @@ export default url, play; scope.tasks = []; - if (scope.selectedPlay) { url = scope.job.url + 'job_tasks/?event_id=' + scope.selectedPlay; url += (scope.search_task_name) ? '&task__icontains=' + scope.search_task_name : ''; @@ -912,16 +911,25 @@ export default scope.tasks[idx].taskActiveClass = ''; } }); - params = { - parent: scope.selectedTask, - event__startswith: 'runner', - page_size: scope.hostResultsMaxRows, - order: 'host_name,counter', - }; - JobDetailService.getRelatedJobEvents(scope.job.id, params).success(function(res){ - scope.hostResults = JobDetailService.processHostEvents(res.results); + if (scope.selectedTask !== null){ + params = { + parent: scope.selectedTask, + event__startswith: 'runner', + page_size: scope.hostResultsMaxRows, + order: 'host_name,counter', + }; + if (scope.search_host_status === 'failed'){ + params.failed = true; + } + JobDetailService.getRelatedJobEvents(scope.job.id, params).success(function(res){ + scope.hostResults = JobDetailService.processHostEvents(res.results); + scope.hostResultsLoading = false; + }); + } + else{ + scope.hostResults = []; scope.hostResultsLoading = false; - }); + } }; }]) diff --git a/awx/ui/client/src/job-detail/job-detail.controller.js b/awx/ui/client/src/job-detail/job-detail.controller.js index 33cf23c1d1..185ab03886 100644 --- a/awx/ui/client/src/job-detail/job-detail.controller.js +++ b/awx/ui/client/src/job-detail/job-detail.controller.js @@ -758,6 +758,15 @@ export default } }; + scope.filterTaskStatus = function() { + scope.search_task_status = (scope.search_task_status === 'all') ? 'failed' : 'all'; + if (!scope.liveEventProcessing || scope.pauseLiveEvents) { + LoadTasks({ + scope: scope + }); + } + }; + scope.filterPlayStatus = function() { scope.search_play_status = (scope.search_play_status === 'all') ? 'failed' : 'all'; if (!scope.liveEventProcessing || scope.pauseLiveEvents) { @@ -767,6 +776,26 @@ export default } }; + scope.filterHostStatus = function(){ + scope.search_host_status = (scope.search_host_status === 'all') ? 'failed' : 'all'; + if (!scope.liveEventProcessing || scope.pauseLiveEvents){ + if (scope.selectedTask !== null && scope.selectedPlay !== null){ + var params = { + parent: scope.selectedTask, + page_size: scope.hostResultsMaxRows, + order: 'host_name,counter', + }; + if (scope.search_host_status === 'failed'){ + params.failed = true; + } + JobDetailService.getRelatedJobEvents(scope.job.id, params).success(function(res){ + scope.hostResults = JobDetailService.processHostEvents(res.results); + scope.hostResultsLoading = false; + }); + } + } + }; + scope.searchPlays = function() { if (scope.search_play_name) { scope.searchPlaysEnabled = false;