diff --git a/awx/ui/static/js/controllers/JobDetail.js b/awx/ui/static/js/controllers/JobDetail.js index 020b300fff..e39d0bd58a 100644 --- a/awx/ui/static/js/controllers/JobDetail.js +++ b/awx/ui/static/js/controllers/JobDetail.js @@ -8,8 +8,8 @@ 'use strict'; function JobDetailController ($location, $rootScope, $scope, $compile, $routeParams, $log, ClearScope, Breadcrumbs, LoadBreadCrumbs, GetBasePath, Wait, Rest, - ProcessErrors, SelectPlay, SelectTask, Socket, GetElapsed, FilterAllByHostName, DrawGraph, LoadHostSummary, ReloadHostSummaryList, - JobIsFinished, SetTaskStyles, DigestEvent, UpdateDOM, EventViewer, DeleteJob, PlaybookRun, HostEventsViewer) { + ProcessErrors, SelectPlay, SelectTask, Socket, GetElapsed, DrawGraph, LoadHostSummary, ReloadHostSummaryList, JobIsFinished, SetTaskStyles, DigestEvent, + UpdateDOM, EventViewer, DeleteJob, PlaybookRun, HostEventsViewer, LoadPlays, LoadTasks, LoadHosts) { ClearScope(); @@ -32,14 +32,19 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar scope.liveEventProcessing = true; // control play/pause state of event processing - scope.search_all_tasks = []; - scope.search_all_plays = []; scope.job_status = {}; scope.job_id = job_id; scope.auto_scroll = false; - scope.searchTaskHostsEnabled = true; - scope.searchSummaryHostsEnabled = true; - scope.searchAllHostsEnabled = true; + + scope.searchPlaysEnabled = true; + scope.searchTasksEnabled = true; + scope.searchHostsEnabled = true; + scope.searchHostSummaryEnabled = true; + scope.search_play_status = 'all'; + scope.search_task_status = 'all'; + scope.search_host_status = 'all'; + scope.search_host_summary_status = 'all'; + scope.haltEventQueue = false; scope.processing = false; scope.lessStatus = true; @@ -676,57 +681,120 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar scope.lessStatus = (scope.lessStatus) ? false : true; }; - scope.searchAllByHost = function() { - if (scope.search_all_hosts_name) { - FilterAllByHostName({ - scope: scope, - host: scope.search_all_hosts_name + scope.filterPlayStatus = function() { + scope.search_play_status = (scope.search_play_status === 'all') ? 'failed' : 'all'; + if (!scope.liveEventProcessing) { + LoadPlays({ + scope: scope }); - scope.searchAllHostsEnabled = false; - } - else { - scope.search_all_tasks = []; - scope.search_all_plays = []; - scope.searchAllHostsEnabled = true; - SelectPlay({ - scope: scope, - id: (scope.plays.length > 0) ? scope.plays[0].id : null - }); - - } - ReloadHostSummaryList({ - scope: scope - }); - }; - - scope.allHostNameKeyPress = function(e) { - if (e.keyCode === 13) { - scope.searchAllByHost(); } }; - scope.filterByStatus = function(choice) { - var nxtPlay; - if (choice === 'Failed') { - scope.searchAllStatus = 'failed'; - nxtPlay = null; - scope.plays.every(function(play) { - if (play.status === 'failed') { - nxtPlay = play.id; - return false; - } - return true; - }); + scope.searchPlays = function() { + if (scope.search_play_name) { + scope.searchPlaysEnabled = false; } else { - scope.searchAllStatus = ''; - nxtPlay = (scope.plays.length > 0) ? scope.plays[0].id : null; + scope.searchPlaysEnabled = true; } if (!scope.liveEventProcessing) { - SelectPlay({ - scope: scope, - id: nxtPlay + LoadPlays({ + scope: scope }); + } + }; + + scope.searchPlaysKeyPress = function(e) { + if (e.keyCode === 13) { + scope.searchPlays(); + e.stopPropagation(); + } + }; + + scope.searchTasks = function() { + if (scope.search_task_name) { + scope.searchTasksEnabled = false; + } + else { + scope.searchTasksEnabled = true; + } + if (!scope.liveEventProcessing) { + LoadTasks({ + scope: scope + }); + } + }; + + scope.searchTasksKeyPress = function(e) { + if (e.keyCode === 13) { + scope.searchTasks(); + e.stopPropagation(); + } + }; + + scope.searchHosts = function() { + if (scope.search_host_name) { + scope.searchHostsEnabled = false; + } + else { + scope.searchHostsEnabled = true; + } + if (!scope.liveEventProcessing) { + LoadHosts({ + scope: scope + }); + } + }; + + scope.searchHostsKeyPress = function(e) { + if (e.keyCode === 13) { + scope.searchHosts(); + e.stopPropagation(); + } + }; + + scope.searchHostSummary = function() { + if (scope.search_host_summary_name) { + scope.searchHostSummaryEnabled = false; + } + else { + scope.searchHostSummaryEnabled = true; + } + if (!scope.liveEventProcessing) { + ReloadHostSummaryList({ + scope: scope + }); + } + }; + + scope.searchHostSummaryKeyPress = function(e) { + if (e.keyCode === 13) { + scope.searchHostSummary(); + e.stopPropagation(); + } + }; + + scope.filterTaskStatus = function() { + scope.search_task_status = (scope.search_task_status === 'all') ? 'failed' : 'all'; + if (!scope.liveEventProcessing) { + LoadTasks({ + scope: scope + }); + } + }; + + scope.filterHostStatus = function() { + scope.search_host_status = (scope.search_host_status === 'all') ? 'failed' : 'all'; + if (!scope.liveEventProcessing) { + LoadHosts({ + scope: scope + }); + } + }; + + scope.filterHostSummaryStatus = function() { + scope.search_host_summary_status = (scope.search_host_summary_status === 'all') ? 'failed' : 'all'; + if (!scope.liveEventProcessing) { ReloadHostSummaryList({ scope: scope }); @@ -772,8 +840,10 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar // check for more plays when user scrolls to bottom of play list... if ((!scope.liveEventProcessing) && scope.plays.length) { - var url = scope.job.url + 'job_plays/?'; - url += '&id__gt=' + scope.plays[scope.plays.length - 1].id + '&page_size=' + scope.playsMaxRows + '&order_by=id'; + var url = scope.job.url + 'job_plays/?id__gt=' + scope.plays[scope.plays.length - 1].id; + url += (scope.search_play_name) ? '&play__icontains=' + scope.search_play_name : ''; + url += (scope.search_play_status === 'failed') ? '&failed=true' : ''; + url += + '&page_size=' + scope.playsMaxRows + '&order_by=id'; Rest.setUrl(url); Rest.get() @@ -837,8 +907,8 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar // check for more tasks when user scrolls to bottom of task list... if ((!scope.liveEventProcessing) && scope.activePlay && scope.tasks.length) { var url = scope.job.url + 'job_tasks/?event_id=' + scope.activePlay; - url += (scope.search_all_tasks.length > 0) ? '&id__in=' + scope.search_all_tasks.join() : ''; - url += (scope.searchAllStatus === 'failed') ? '&failed=true' : ''; + url += (scope.search_task_name) ? '&name__icontains=' + scope.search_task_name : ''; + url += (scope.search_task_status === 'failed') ? '&failed=true' : ''; url += '&id__gt=' + scope.tasks[scope.tasks.length - 1].id + '&page_size=' + scope.tasksMaxRows + '&order_by=id'; $('#tasksMoreRows').fadeIn(); Rest.setUrl(url); @@ -910,8 +980,8 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar // check for more hosts when user scrolls to bottom of host results list... if ((!scope.liveEventProcessing) && scope.activeTask && scope.hostResults.length) { var url = GetBasePath('jobs') + job_id + '/job_events/?parent=' + scope.activeTask + '&'; - url += (scope.search_all_hosts_name) ? 'host__name__icontains=' + scope.search_all_hosts_name + '&' : ''; - url += (scope.searchAllStatus === 'failed') ? 'failed=true&' : ''; + url += (scope.search_host_name) ? 'host__name__icontains=' + scope.search_host_name + '&' : ''; + url += (scope.search_host_status === 'failed') ? '&failed=true' : ''; url += 'host__name__gt=' + scope.hostResults[scope.hostResults.length - 1].name + '&page_size=' + scope.hostResultsMaxRows + '&order_by=host__name'; $('#hostResultsMoreRows').fadeIn(); @@ -970,8 +1040,8 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar // check for more hosts when user scrolls to bottom of host summaries list... if ((!scope.liveEventProcessing) && scope.hosts) { var url = GetBasePath('jobs') + job_id + '/job_host_summaries/?'; - url += (scope.search_all_hosts_name) ? 'host__name__icontains=' + scope.search_all_hosts_name + '&' : ''; - url += (scope.searchAllStatus === 'failed') ? 'failed=true&' : ''; + url += (scope.search_host_summary_name) ? 'host__name__icontains=' + scope.search_host_summary_name + '&' : ''; + url += (scope.search_host_summary_status === 'failed') ? 'failed=true&' : ''; url += 'host__name__gt=' + scope.hosts[scope.hosts.length - 1].name + '&page_size=' + scope.hostSummariesMaxRows + '&order_by=host__name'; $('#hostSummariesMoreRows').fadeIn(); Rest.setUrl(url); @@ -1017,6 +1087,7 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar } JobDetailController.$inject = [ '$location', '$rootScope', '$scope', '$compile', '$routeParams', '$log', 'ClearScope', 'Breadcrumbs', 'LoadBreadCrumbs', 'GetBasePath', - 'Wait', 'Rest', 'ProcessErrors', 'SelectPlay', 'SelectTask', 'Socket', 'GetElapsed', 'FilterAllByHostName', 'DrawGraph', 'LoadHostSummary', 'ReloadHostSummaryList', - 'JobIsFinished', 'SetTaskStyles', 'DigestEvent', 'UpdateDOM', 'EventViewer', 'DeleteJob', 'PlaybookRun', 'HostEventsViewer' + 'Wait', 'Rest', 'ProcessErrors', 'SelectPlay', 'SelectTask', 'Socket', 'GetElapsed', 'DrawGraph', 'LoadHostSummary', 'ReloadHostSummaryList', + 'JobIsFinished', 'SetTaskStyles', 'DigestEvent', 'UpdateDOM', 'EventViewer', 'DeleteJob', 'PlaybookRun', 'HostEventsViewer', 'LoadPlays', 'LoadTasks', + 'LoadHosts' ]; diff --git a/awx/ui/static/js/helpers/JobDetail.js b/awx/ui/static/js/helpers/JobDetail.js index 4f62ae64cf..e9b3569ca9 100644 --- a/awx/ui/static/js/helpers/JobDetail.js +++ b/awx/ui/static/js/helpers/JobDetail.js @@ -555,21 +555,83 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge }; }]) +.factory('LoadPlays', ['Rest', 'ProcessErrors', 'GetElapsed', 'SelectPlay', 'JobIsFinished', + function(Rest, ProcessErrors, GetElapsed, SelectPlay, JobIsFinished) { + return function(params) { + var scope = params.scope, + callback = params.callback, + url; + + scope.plays = []; + + url = scope.job.url + 'job_plays/?page_size=' + scope.playsMaxRows + '&order_by=id'; + url += (scope.search_play_name) ? '&play__icontains=' + scope.search_play_name : ''; + url += (scope.search_play_status === 'failed') ? '&failed=true' : ''; + + Rest.setUrl(url); + Rest.get() + .success(function(data) { + data.results.forEach(function(event, idx) { + var status, status_text, start, end, elapsed; + + status = (event.failed) ? 'failed' : (event.changed) ? 'changed' : 'successful'; + status_text = (event.failed) ? 'Failed' : (event.changed) ? 'Changed' : 'OK'; + start = event.started; + + if (idx < data.length - 1) { + // end date = starting date of the next event + end = data[idx + 1].started; + } + else if (JobIsFinished(scope)) { + // this is the last play and the job already finished + end = scope.job_status.finished; + } + if (end) { + elapsed = GetElapsed({ + start: start, + end: end + }); + } + else { + elapsed = '00:00:00'; + } + + scope.plays.push({ + id: event.id, + name: event.play, + created: start, + finished: end, + status: status, + status_text: status_text, + status_tip: "Event ID: " + event.id + "
Status: " + status_text, + elapsed: elapsed, + hostCount: 0, + fistTask: null, + playActiveClass: '', + unreachableCount: (event.unreachable_count) ? event.unreachable_count : 0, + }); + }); + + // set the active task + SelectPlay({ + scope: scope, + id: (scope.plays.length > 0) ? scope.plays[0].id : null, + callback: callback + }); + }) + .error(function(data) { + ProcessErrors(scope, data, status, null, { hdr: 'Error!', + msg: 'Call to ' + url + '. GET returned: ' + status }); + }); + }; +}]) + // Call SelectPlay whenever the the activePlay needs to change .factory('SelectPlay', ['SelectTask', 'LoadTasks', function(SelectTask, LoadTasks) { return function(params) { var scope = params.scope, id = params.id, - callback = params.callback, - clear = false; - - // Determine if the tasks and hostResults arrays should be initialized - if (scope.search_all_hosts_name || scope.searchAllStatus === 'failed') { - clear = true; - } - else { - clear = (scope.activePlay === id) ? false : true; //are we moving to a new play? - } + callback = params.callback; scope.activePlay = id; scope.plays.forEach(function(play, idx) { @@ -581,14 +643,10 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge } }); - setTimeout(function() { - scope.$apply(function() { - LoadTasks({ - scope: scope, - callback: callback, - clear: true - }); - }); + LoadTasks({ + scope: scope, + callback: callback, + clear: true }); }; @@ -598,18 +656,15 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge return function(params) { var scope = params.scope, callback = params.callback, - clear = params.clear, url; - if (clear) { - scope.tasks = []; - scope.tasksMap = {}; - } + scope.tasks = []; + scope.tasksMap = {}; if (scope.activePlay) { url = scope.job.url + 'job_tasks/?event_id=' + scope.activePlay; - url += (scope.search_all_tasks.length > 0) ? '&id__in=' + scope.search_all_tasks.join() : ''; - url += (scope.searchAllStatus === 'failed') ? '&failed=true' : ''; + url += (scope.search_task_name) ? '&name__icontains=' + scope.search_task_name : ''; + url += (scope.search_task_status === 'failed') ? '&failed=true' : ''; url += '&page_size=' + scope.tasksMaxRows + '&order_by=id'; Rest.setUrl(url); @@ -618,11 +673,6 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge data.results.forEach(function(event, idx) { var end, elapsed, status, status_text; - //if (!scope.plays[scope.playsMap[scope.activePlay]].firstTask) { - // scope.plays[scope.playsMap[scope.activePlay]].firstTask = event.id; - // scope.plays[scope.playsMap[scope.activePlay]].hostCount = (event.host_count) ? event.host_count : 0; - //} - if (idx < data.length - 1) { // end date = starting date of the next event end = data[idx + 1].created; @@ -684,7 +734,6 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge callback: callback }); - //$('#tasks-table-detail').mCustomScrollbar("update"); }) .error(function(data) { ProcessErrors(scope, data, status, null, { hdr: 'Error!', @@ -707,15 +756,7 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge return function(params) { var scope = params.scope, id = params.id, - callback = params.callback, - clear=false; - - if (scope.search_all_hosts_name || scope.searchAllStatus === 'failed') { - clear = true; - } - else { - clear = (scope.activeTask === id) ? false : true; - } + callback = params.callback; scope.activeTask = id; scope.tasks.forEach(function(task, idx) { @@ -740,19 +781,16 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge return function(params) { var scope = params.scope, callback = params.callback, - clear = params.clear, url; - if (clear) { - scope.hostResults = []; - scope.hostResultsMap = {}; - } + scope.hostResults = []; + scope.hostResultsMap = {}; if (scope.activeTask) { // If we have a selected task, then get the list of hosts url = scope.job.related.job_events + '?parent=' + scope.activeTask + '&'; - url += (scope.search_all_hosts_name) ? 'host__name__icontains=' + scope.search_all_hosts_name + '&' : ''; - url += (scope.searchAllStatus === 'failed') ? 'failed=true&' : ''; + url += (scope.search_host_name) ? 'host__name__icontains=' + scope.search_host_name + '&' : ''; + url += (scope.search_host_status === 'failed') ? 'failed=true&' : ''; url += 'event__icontains=runner&page_size=' + scope.hostResultsMaxRows + '&order_by=host__name'; Rest.setUrl(url); Rest.get() @@ -798,7 +836,6 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge if (callback) { scope.$emit(callback); } - //$('#hosts-table-detail').mCustomScrollbar("update"); }) .error(function(data, status) { ProcessErrors(scope, data, status, null, { hdr: 'Error!', @@ -822,8 +859,8 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge url; url = scope.job.related.job_host_summaries + '?'; - url += (scope.search_all_hosts_name) ? 'host__name__icontains=' + scope.search_all_hosts_name + '&': ''; - url += (scope.searchAllStatus === 'failed') ? 'failed=true&' : ''; + url += (scope.search_host_summary_name) ? 'host__name__icontains=' + scope.search_host_summary_name + '&': ''; + url += (scope.search_host_summary_status === 'failed') ? 'failed=true&' : ''; url += '&page_size=' + scope.hostSummariesMaxRows + '&order_by=host__name'; scope.hosts = []; @@ -952,7 +989,10 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge result = [], newKeys = [], plays = JSON.parse(JSON.stringify(scope.jobData.plays)), - keys = Object.keys(plays); + filteredListA = [], + filteredListB = [], + key, + keys; function listSort(a,b) { if (parseInt(a,10) < parseInt(b,10)) @@ -962,6 +1002,29 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge return 0; } + if (scope.search_play_name) { + for (key in plays) { + if (plays[key].name.indexOf(scope.search_play_name) > 0) { + filteredListA[key] = plays[key]; + } + } + } + else { + filteredListA = plays; + } + + if (scope.search_play_status === 'failed') { + for (key in filteredListA) { + if (filteredListA[key].status === 'failed') { + filteredListB[key] = plays[key]; + } + } + } + else { + filteredListB = filteredListA; + } + + keys = Object.keys(filteredListB); keys.sort(function(a,b) { return listSort(a,b); }).reverse(); for (idx=0; idx < scope.playsMaxRows && idx < keys.length; idx++) { newKeys.push(keys[idx]); @@ -969,7 +1032,7 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge newKeys.sort(function(a,b) { return listSort(a,b); }); idx = 0; while (idx < newKeys.length) { - result.push(plays[newKeys[idx]]); + result.push(filteredListB[newKeys[idx]]); idx++; } scope.plays = result; @@ -983,7 +1046,9 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge return function(params) { var scope = params.scope, result = [], - idx, keys, newKeys, tasks; + filteredListA = [], + filteredListB = [], + idx, key, keys, newKeys, tasks; function listSort(a,b) { if (parseInt(a,10) < parseInt(b,10)) @@ -994,8 +1059,32 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge } if (scope.activePlay) { + tasks = JSON.parse(JSON.stringify(scope.jobData.plays[scope.activePlay].tasks)); - keys = Object.keys(tasks); + + if (scope.search_task_name) { + for (key in tasks) { + if (tasks[key].name.indexOf(scope.search_task_name) > 0) { + filteredListA[key] = tasks[key]; + } + } + } + else { + filteredListA = tasks; + } + + if (scope.search_task_status === 'failed') { + for (key in filteredListA) { + if (filteredListA[key].status === 'failed') { + filteredListB[key] = tasks[key]; + } + } + } + else { + filteredListB = filteredListA; + } + + keys = Object.keys(filteredListB); keys.sort(function(a,b) { return listSort(a,b); }).reverse(); newKeys = []; for (idx=0; result.length < scope.tasksMaxRows && idx < keys.length; idx++) { @@ -1004,7 +1093,7 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge newKeys.sort(function(a,b) { return listSort(a,b); }); idx = 0; while (idx < newKeys.length) { - result.push(tasks[newKeys[idx]]); + result.push(filteredListB[newKeys[idx]]); idx++; } } @@ -1020,30 +1109,50 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge return function(params) { var scope = params.scope, result = [], + filteredListA = [], + filteredListB = [], idx = 0, hostResults, + key, keys; if (scope.activePlay && scope.activeTask) { + hostResults = JSON.parse(JSON.stringify(scope.jobData.plays[scope.activePlay].tasks[scope.activeTask].hostResults)); - keys = Object.keys(hostResults); + + if (scope.search_host_name) { + for (key in hostResults) { + if (hostResults[key].name.indexOf(scope.search_host_name) > 0) { + filteredListA[key] = hostResults[key]; + } + } + } + else { + filteredListA = hostResults; + } + + if (scope.search_host_status === 'failed') { + for (key in filteredListA) { + if (filteredListA[key].status === 'failed') { + filteredListB[key] = filteredListA[key]; + } + } + } + else { + filteredListB = filteredListA; + } + + keys = Object.keys(filteredListB); keys.sort(function(a,b) { - if (hostResults[a].name > hostResults[b].name) + if (filteredListB[a].name > filteredListB[b].name) return -1; - if (hostResults[a].name < hostResults[b].name) + if (filteredListB[a].name < filteredListB[b].name) return 1; // a must be equal to b return 0; }); while (idx < keys.length && result.length < scope.hostResultsMaxRows) { - if (scope.searchAllStatus === 'failed') { - if (hostResults[keys[idx]].status === 'failed') { - result.unshift(hostResults[keys[idx]]); - } - } - else { - result.unshift(hostResults[keys[idx]]); - } + result.unshift(filteredListB[keys[idx]]); idx++; } } @@ -1058,43 +1167,58 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge return function(params) { var scope = params.scope, result = [], + filteredListA = [], + filteredListB = [], idx = 0, hostSummaries, + key, keys; if (scope.activePlay && scope.activeTask) { hostSummaries = JSON.parse(JSON.stringify(scope.jobData.hostSummaries)); - keys = Object.keys(hostSummaries); + + if (scope.search_host_summary_name) { + for (key in hostSummaries) { + if (hostSummaries[key].name.indexOf(scope.search_host_summary_name) > 0) { + filteredListA[key] = hostSummaries[key]; + } + } + } + else { + filteredListA = hostSummaries; + } + + if (scope.search_host_summary_status === 'failed') { + for (key in filteredListA) { + if (filteredListA[key].status === 'failed') { + filteredListB[key] = filteredListA[key]; + } + } + } + else { + filteredListB = filteredListA; + } + + keys = Object.keys(filteredListB); keys.sort(function(a,b) { - if (hostSummaries[a].name > hostSummaries[b].name) + if (filteredListB[a].name > filteredListB[b].name) return 1; - if (hostSummaries[a].name < hostSummaries[b].name) + if (filteredListB[a].name < filteredListB[b].name) return -1; // a must be equal to b return 0; }); while (idx < keys.length && result.length < scope.hostSummariesMaxRows) { - if (scope.searchAllStatus === 'failed') { - if (hostSummaries[keys[idx]].status === 'failed') { - result.push(hostSummaries[keys[idx]]); - } - } - else { - result.push(hostSummaries[keys[idx]]); - } + result.push(filteredListB[keys[idx]]); idx++; } } scope.hosts = result; - if (scope.liveEventProcessing) { - scope.$emit('FixHostSummariesScroll'); - } }; }]) - .factory('UpdateDOM', ['DrawPlays', 'DrawTasks', 'DrawHostResults', 'DrawHostSummaries', 'DrawGraph', function(DrawPlays, DrawTasks, DrawHostResults, DrawHostSummaries, DrawGraph) { return function(params) { @@ -1109,91 +1233,4 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge DrawGraph({ scope: scope, resize: true }); } }; -}]) - -.factory('FilterAllByHostName', ['Rest', 'GetBasePath', 'ProcessErrors', 'SelectPlay', function(Rest, GetBasePath, ProcessErrors, SelectPlay) { - return function(params) { - var scope = params.scope, - host = params.host, - newActivePlay, - url = scope.job.related.job_events + '?event__icontains=runner&host_name__icontains=' + host + '&parent__isnull=false'; - - scope.search_all_tasks = []; - scope.search_all_plays = []; - - if (scope.removeAllPlaysReady) { - scope.removeAllPlaysReady(); - } - scope.removeAllPlaysReady = scope.$on('AllPlaysReady', function() { - if (scope.activePlay) { - setTimeout(function() { - SelectPlay({ - scope: scope, - id: newActivePlay - }); - }, 500); - } - else { - scope.tasks = []; - scope.hostResults = []; - } - }); - - if (scope.removeAllTasksReady) { - scope.removeAllTasksReady(); - } - scope.removeAllTasksReady = scope.$on('AllTasksReady', function() { - if (scope.search_all_tasks.length > 0) { - url = scope.job.related.job_events + '?id__in=' + scope.search_all_tasks.join(); - Rest.setUrl(url); - Rest.get() - .success(function(data) { - if (data.count > 0) { - data.results.forEach(function(row) { - if (row.parent && scope.search_all_plays.indexOf(row.parent) < 0) { - scope.search_all_plays.push(row.parent); - } - }); - if (scope.search_all_plays.length > 0) { - scope.search_all_plays.sort(); - newActivePlay = scope.search_all_plays[0]; - } - else { - newActivePlay = null; - } - } - scope.$emit('AllPlaysReady'); - }) - .error(function(data, status) { - ProcessErrors(scope, data, status, null, { hdr: 'Error!', - msg: 'Call to ' + url + '. GET returned: ' + status }); - }); - } - else { - newActivePlay = null; - scope.search_all_plays.push(0); - scope.$emit('AllPlaysReady'); - } - }); - - Rest.setUrl(url); - Rest.get() - .success(function(data) { - if (data.count > 0) { - data.results.forEach(function(row) { - if (scope.search_all_tasks.indexOf(row.parent) < 0) { - scope.search_all_tasks.push(row.parent); - } - }); - if (scope.search_all_tasks.length > 0) { - scope.search_all_tasks.sort(); - } - } - scope.$emit('AllTasksReady'); - }) - .error(function(data, status) { - ProcessErrors(scope, data, status, null, { hdr: 'Error!', - msg: 'Call to ' + url + '. GET returned: ' + status }); - }); - }; }]); diff --git a/awx/ui/static/partials/job_detail.html b/awx/ui/static/partials/job_detail.html index d608094c04..db303dc8d7 100644 --- a/awx/ui/static/partials/job_detail.html +++ b/awx/ui/static/partials/job_detail.html @@ -15,26 +15,26 @@
- - - - - + + + + +
- -
+ +
{{ 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 }}
@@ -42,22 +42,22 @@
- -
- -
+ +
- -
+ +
@@ -79,7 +79,7 @@
Plays
-
+
@@ -93,12 +93,12 @@
-
+
- +
@@ -111,8 +111,7 @@
-
+