mirror of
https://github.com/ansible/awx.git
synced 2026-05-10 02:47:36 -02:30
Job detail page refactor
Improved handling of scrollbar refresh. Handling on via scope.$emit rather than inside the http response. Fixed pie chart drawing at job completion so that totaling of stats on playbook_on_stats event matches the way we're counting hosts during event processing.
This commit is contained in:
committed by
Luke Sneeringer
parent
22d5f061dd
commit
0fc977648e
@@ -8,7 +8,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log, ClearScope, Breadcrumbs, LoadBreadCrumbs, GetBasePath, Wait, Rest,
|
function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log, ClearScope, Breadcrumbs, LoadBreadCrumbs, GetBasePath, Wait, Rest,
|
||||||
ProcessErrors, ProcessEventQueue, SelectPlay, SelectTask, Socket, GetElapsed, SelectHost, FilterAllByHostName, DrawGraph, LoadHostSummary, ReloadHostSummaryList,
|
ProcessErrors, ProcessEventQueue, SelectPlay, SelectTask, Socket, GetElapsed, FilterAllByHostName, DrawGraph, LoadHostSummary, ReloadHostSummaryList,
|
||||||
JobIsFinished, SetTaskStyles) {
|
JobIsFinished, SetTaskStyles) {
|
||||||
|
|
||||||
ClearScope();
|
ClearScope();
|
||||||
@@ -31,10 +31,10 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log,
|
|||||||
scope.hostResultsMap = {};
|
scope.hostResultsMap = {};
|
||||||
api_complete = false;
|
api_complete = false;
|
||||||
|
|
||||||
scope.hostTableRows = 150;
|
scope.hostTableRows = 75;
|
||||||
scope.hostSummaryTableRows = 150;
|
scope.hostSummaryTableRows = 75;
|
||||||
scope.tasksMaxRows = 150;
|
scope.tasksMaxRows = 75;
|
||||||
scope.playsMaxRows = 150;
|
scope.playsMaxRows = 75;
|
||||||
|
|
||||||
scope.search_all_tasks = [];
|
scope.search_all_tasks = [];
|
||||||
scope.search_all_plays = [];
|
scope.search_all_plays = [];
|
||||||
@@ -188,8 +188,11 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log,
|
|||||||
scope.removeRefreshJobDetails = scope.$on('LoadJobDetails', function(e, events_url) {
|
scope.removeRefreshJobDetails = scope.$on('LoadJobDetails', function(e, events_url) {
|
||||||
// Call to load all the job bits including, plays, tasks, hosts results and host summary
|
// Call to load all the job bits including, plays, tasks, hosts results and host summary
|
||||||
|
|
||||||
scope.plays = [];
|
scope.host_summary.ok = 0;
|
||||||
scope.playsMap = {};
|
scope.host_summary.changed = 0;
|
||||||
|
scope.host_summary.unreachable = 0;
|
||||||
|
scope.host_summary.failed = 0;
|
||||||
|
scope.host_summary.total = 0;
|
||||||
|
|
||||||
var url = scope.job.url + 'job_plays/?order_by=id';
|
var url = scope.job.url + 'job_plays/?order_by=id';
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
@@ -198,7 +201,7 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log,
|
|||||||
data.forEach(function(event, idx) {
|
data.forEach(function(event, idx) {
|
||||||
var status = (event.failed) ? 'failed' : (event.changed) ? 'changed' : 'successful',
|
var status = (event.failed) ? 'failed' : (event.changed) ? 'changed' : 'successful',
|
||||||
start = event.started,
|
start = event.started,
|
||||||
end, elapsed;
|
end, elapsed, play;
|
||||||
|
|
||||||
if (idx < data.length - 1) {
|
if (idx < data.length - 1) {
|
||||||
// end date = starting date of the next event
|
// end date = starting date of the next event
|
||||||
@@ -218,18 +221,29 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log,
|
|||||||
elapsed = '00:00:00';
|
elapsed = '00:00:00';
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.plays.push({
|
if (scope.playsMap[event.id] !== undefined) {
|
||||||
id: event.id,
|
play = scope.plays[scope.playsMap[event.id]];
|
||||||
name: event.play,
|
play.finished = end;
|
||||||
created: start,
|
play.status = status;
|
||||||
finished: end,
|
play.elapsed = elapsed;
|
||||||
status: status,
|
play.playActiveClass = '';
|
||||||
elapsed: elapsed,
|
}
|
||||||
playActiveClass: '',
|
else {
|
||||||
hostCount: 0,
|
scope.plays.push({
|
||||||
fistTask: null
|
id: event.id,
|
||||||
});
|
name: event.play,
|
||||||
scope.playsMap[event.id] = scope.plays.length - 1;
|
created: start,
|
||||||
|
finished: end,
|
||||||
|
status: status,
|
||||||
|
elapsed: elapsed,
|
||||||
|
playActiveClass: '',
|
||||||
|
hostCount: 0,
|
||||||
|
fistTask: null
|
||||||
|
});
|
||||||
|
if (scope.plays.length > scope.playsMaxRows) {
|
||||||
|
scope.plays.shift();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
scope.host_summary.ok += (data.ok_count) ? data.ok_count : 0;
|
scope.host_summary.ok += (data.ok_count) ? data.ok_count : 0;
|
||||||
scope.host_summary.changed += (data.changed_count) ? data.changed_count : 0;
|
scope.host_summary.changed += (data.changed_count) ? data.changed_count : 0;
|
||||||
@@ -239,7 +253,14 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log,
|
|||||||
scope.host_summary.unreachable + scope.host_summary.failed;
|
scope.host_summary.unreachable + scope.host_summary.failed;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//rebuild the index
|
||||||
|
scope.playsMap = {};
|
||||||
|
scope.plays.forEach(function(play, idx) {
|
||||||
|
scope.playsMap[play.id] = idx;
|
||||||
|
});
|
||||||
|
|
||||||
scope.$emit('PlaysReady', events_url);
|
scope.$emit('PlaysReady', events_url);
|
||||||
|
scope.$emit('FixPlaysScroll');
|
||||||
})
|
})
|
||||||
.error( function(data, status) {
|
.error( function(data, status) {
|
||||||
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
||||||
@@ -334,6 +355,7 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log,
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
if (scope.removeRefreshCompleted) {
|
if (scope.removeRefreshCompleted) {
|
||||||
scope.removeRefreshCompleted();
|
scope.removeRefreshCompleted();
|
||||||
}
|
}
|
||||||
@@ -349,6 +371,41 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log,
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (scope.removeFixPlaysScroll) {
|
||||||
|
scope.removeFixPlaysScroll();
|
||||||
|
}
|
||||||
|
scope.removeFixPlaysScroll = scope.$on('FixPlaysScroll', function() {
|
||||||
|
$('#plays-table-detail').mCustomScrollbar("update");
|
||||||
|
setTimeout( function() {
|
||||||
|
scope.auto_scroll = true;
|
||||||
|
$('#tasks-table-detail').mCustomScrollbar("scrollTo", "bottom");
|
||||||
|
}, 500);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (scope.removeFixTasksScroll) {
|
||||||
|
scope.removeFixTasksScroll();
|
||||||
|
}
|
||||||
|
scope.removeFixTasksScroll = scope.$on('FixTasksScroll', function() {
|
||||||
|
$('#tasks-table-detail').mCustomScrollbar("update");
|
||||||
|
setTimeout( function() {
|
||||||
|
scope.auto_scroll = true;
|
||||||
|
$('#tasks-table-detail').mCustomScrollbar("scrollTo", "bottom");
|
||||||
|
}, 500);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
if (scope.removeFixHostResultsScroll) {
|
||||||
|
scope.removeFixHostResultsScroll();
|
||||||
|
}
|
||||||
|
scope.removeFixHostResultsScroll = scope.$on('FixHostResultsScroll', function() {
|
||||||
|
$('#hosts-table-detail').mCustomScrollbar("update");
|
||||||
|
setTimeout( function() {
|
||||||
|
scope.auto_scroll = true;
|
||||||
|
$('#hosts-table-detail').mCustomScrollbar("scrollTo", "bottom");
|
||||||
|
}, 500);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
scope.adjustSize = function() {
|
scope.adjustSize = function() {
|
||||||
var height, ww = $(window).width();
|
var height, ww = $(window).width();
|
||||||
if (ww < 1240) {
|
if (ww < 1240) {
|
||||||
@@ -512,7 +569,7 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log,
|
|||||||
url = GetBasePath('jobs') + job_id + '/job_events/?parent=' + scope.activeTask + '&';
|
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.search_all_hosts_name) ? 'host__name__icontains=' + scope.search_all_hosts_name + '&' : '';
|
||||||
url += (scope.searchAllStatus === 'failed') ? 'failed=true&' : '';
|
url += (scope.searchAllStatus === 'failed') ? 'failed=true&' : '';
|
||||||
url += 'host__name__gt=' + scope.hostResults[scope.hostResults.length - 1].name + '&host__isnull=false&page_size=' + (scope.hostTableRows / 3) + '&order_by=host__name';
|
url += 'host__name__gt=' + scope.hostResults[scope.hostResults.length - 1].name + '&host__isnull=false&page_size=' + scope.hostTableRows + '&order_by=host__name';
|
||||||
Wait('start');
|
Wait('start');
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
Rest.get()
|
Rest.get()
|
||||||
@@ -559,7 +616,7 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log,
|
|||||||
url = GetBasePath('jobs') + job_id + '/job_events/?parent=' + scope.activeTask + '&';
|
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.search_all_hosts_name) ? 'host__name__icontains=' + scope.search_all_hosts_name + '&' : '';
|
||||||
url += (scope.searchAllStatus === 'failed') ? 'failed=true&' : '';
|
url += (scope.searchAllStatus === 'failed') ? 'failed=true&' : '';
|
||||||
url += 'host__name__lt=' + scope.hostResults[0].name + '&host__isnull=false&page_size=' + (scope.hostTableRows / 3) + '&order_by=-host__name';
|
url += 'host__name__lt=' + scope.hostResults[0].name + '&host__isnull=false&page_size=' + scope.hostTableRows + '&order_by=-host__name';
|
||||||
Wait('start');
|
Wait('start');
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
Rest.get()
|
Rest.get()
|
||||||
@@ -606,7 +663,7 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log,
|
|||||||
url = scope.job.url + 'job_tasks/?event_id=' + 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.search_all_tasks.length > 0) ? '&id__in=' + scope.search_all_tasks.join() : '';
|
||||||
url += (scope.searchAllStatus === 'failed') ? '&failed=true' : '';
|
url += (scope.searchAllStatus === 'failed') ? '&failed=true' : '';
|
||||||
url += '&id__gt=' + scope.tasks[scope.tasks.length - 1].id + '&page_size=' + (scope.tasksMaxRows / 3) + '&order_by=id';
|
url += '&id__gt=' + scope.tasks[scope.tasks.length - 1].id + '&page_size=' + scope.tasksMaxRows + '&order_by=id';
|
||||||
Wait('start');
|
Wait('start');
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
Rest.get()
|
Rest.get()
|
||||||
@@ -684,7 +741,7 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log,
|
|||||||
url = scope.job.url + 'job_tasks/?event_id=' + 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.search_all_tasks.length > 0) ? '&id__in=' + scope.search_all_tasks.join() : '';
|
||||||
url += (scope.searchAllStatus === 'failed') ? '&failed=true' : '';
|
url += (scope.searchAllStatus === 'failed') ? '&failed=true' : '';
|
||||||
url += '&id__lt=' + scope.tasks[scope.tasks[0]].name + '&page_size=' + (scope.tasksMaxRows / 3) + '&order_by=id';
|
url += '&id__lt=' + scope.tasks[scope.tasks[0]].id + '&page_size=' + scope.tasksMaxRows + '&order_by=id';
|
||||||
Wait('start');
|
Wait('start');
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
Rest.get()
|
Rest.get()
|
||||||
@@ -759,7 +816,7 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log,
|
|||||||
url = GetBasePath('jobs') + job_id + '/job_host_summaries/?';
|
url = GetBasePath('jobs') + job_id + '/job_host_summaries/?';
|
||||||
url += (scope.search_all_hosts_name) ? 'host__name__icontains=' + scope.search_all_hosts_name + '&' : '';
|
url += (scope.search_all_hosts_name) ? 'host__name__icontains=' + scope.search_all_hosts_name + '&' : '';
|
||||||
url += (scope.searchAllStatus === 'failed') ? 'failed=true&' : '';
|
url += (scope.searchAllStatus === 'failed') ? 'failed=true&' : '';
|
||||||
url += 'host__name__gt=' + scope.hosts[scope.hosts.length - 1].name + '&page_size=' + (scope.hostSummaryTableRows / 3) + '&order_by=host__name';
|
url += 'host__name__gt=' + scope.hosts[scope.hosts.length - 1].name + '&page_size=' + scope.hostSummaryTableRows + '&order_by=host__name';
|
||||||
Wait('start');
|
Wait('start');
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
Rest.get()
|
Rest.get()
|
||||||
@@ -803,7 +860,7 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log,
|
|||||||
url = GetBasePath('jobs') + job_id + '/job_host_summaries/?';
|
url = GetBasePath('jobs') + job_id + '/job_host_summaries/?';
|
||||||
url += (scope.search_all_hosts_name) ? 'host__name__icontains=' + scope.search_all_hosts_name + '&' : '';
|
url += (scope.search_all_hosts_name) ? 'host__name__icontains=' + scope.search_all_hosts_name + '&' : '';
|
||||||
url += (scope.searchAllStatus === 'failed') ? 'failed=true&' : '';
|
url += (scope.searchAllStatus === 'failed') ? 'failed=true&' : '';
|
||||||
url += 'host__name__lt=' + scope.hosts[0].name + '&page_size=' + (scope.hostSummaryTableRows / 3) + '&order_by=-host__name';
|
url += 'host__name__lt=' + scope.hosts[0].name + '&page_size=' + scope.hostSummaryTableRows + '&order_by=-host__name';
|
||||||
Wait('start');
|
Wait('start');
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
Rest.get()
|
Rest.get()
|
||||||
@@ -904,6 +961,6 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log,
|
|||||||
}
|
}
|
||||||
|
|
||||||
JobDetailController.$inject = [ '$rootScope', '$scope', '$compile', '$routeParams', '$log', 'ClearScope', 'Breadcrumbs', 'LoadBreadCrumbs', 'GetBasePath',
|
JobDetailController.$inject = [ '$rootScope', '$scope', '$compile', '$routeParams', '$log', 'ClearScope', 'Breadcrumbs', 'LoadBreadCrumbs', 'GetBasePath',
|
||||||
'Wait', 'Rest', 'ProcessErrors', 'ProcessEventQueue', 'SelectPlay', 'SelectTask', 'Socket', 'GetElapsed', 'SelectHost', 'FilterAllByHostName', 'DrawGraph',
|
'Wait', 'Rest', 'ProcessErrors', 'ProcessEventQueue', 'SelectPlay', 'SelectTask', 'Socket', 'GetElapsed', 'FilterAllByHostName', 'DrawGraph',
|
||||||
'LoadHostSummary', 'ReloadHostSummaryList', 'JobIsFinished', 'SetTaskStyles'
|
'LoadHostSummary', 'ReloadHostSummaryList', 'JobIsFinished', 'SetTaskStyles'
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
|||||||
fistTask: null
|
fistTask: null
|
||||||
});
|
});
|
||||||
scope.playsMap[event.id] = scope.plays.length -1;
|
scope.playsMap[event.id] = scope.plays.length -1;
|
||||||
if (scope.activePlay && scope.playsMap[scope.activePlay] !== undefined) {
|
if (scope.playsMap[scope.activePlay] !== undefined) {
|
||||||
scope.plays[scope.playsMap[scope.activePlay]].playActiveClass = '';
|
scope.plays[scope.playsMap[scope.activePlay]].playActiveClass = '';
|
||||||
}
|
}
|
||||||
scope.activePlay = event.id;
|
scope.activePlay = event.id;
|
||||||
@@ -99,6 +99,7 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
|||||||
scope.hostResultsMap = {};
|
scope.hostResultsMap = {};
|
||||||
$('#hosts-table-detail').mCustomScrollbar("update");
|
$('#hosts-table-detail').mCustomScrollbar("update");
|
||||||
$('#tasks-table-detail').mCustomScrollbar("update");
|
$('#tasks-table-detail').mCustomScrollbar("update");
|
||||||
|
scope.$emit('FixPlaysScroll');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'playbook_on_setup':
|
case 'playbook_on_setup':
|
||||||
@@ -280,12 +281,7 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
|||||||
scope.hasRoles = (event.role) ? true : false;
|
scope.hasRoles = (event.role) ? true : false;
|
||||||
|
|
||||||
$('#hosts-table-detail').mCustomScrollbar("update");
|
$('#hosts-table-detail').mCustomScrollbar("update");
|
||||||
$('#tasks-table-detail').mCustomScrollbar("update");
|
scope.$emit('FixTasksScroll');
|
||||||
setTimeout( function() {
|
|
||||||
scope.auto_scroll = true;
|
|
||||||
$('#tasks-table-detail').mCustomScrollbar("scrollTo", "bottom");
|
|
||||||
|
|
||||||
}, 1500);
|
|
||||||
|
|
||||||
// Record the first task id
|
// Record the first task id
|
||||||
UpdatePlayStatus({
|
UpdatePlayStatus({
|
||||||
@@ -340,7 +336,7 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
|||||||
status_text = params.status_text,
|
status_text = params.status_text,
|
||||||
play;
|
play;
|
||||||
|
|
||||||
if (scope.playsMap[id]) {
|
if (scope.playsMap[id] !== undefined) {
|
||||||
play = scope.plays[scope.playsMap[id]];
|
play = scope.plays[scope.playsMap[id]];
|
||||||
if (failed) {
|
if (failed) {
|
||||||
play.status = 'failed';
|
play.status = 'failed';
|
||||||
@@ -380,7 +376,7 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
|||||||
no_hosts = params.no_hosts,
|
no_hosts = params.no_hosts,
|
||||||
task;
|
task;
|
||||||
|
|
||||||
if (scope.tasksMap[id]) {
|
if (scope.tasksMap[id] !== undefined) {
|
||||||
task = scope.tasks[scope.tasksMap[id]];
|
task = scope.tasks[scope.tasksMap[id]];
|
||||||
if (no_hosts){
|
if (no_hosts){
|
||||||
task.status = 'no-matching-hosts';
|
task.status = 'no-matching-hosts';
|
||||||
@@ -582,14 +578,15 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
|||||||
var scope = params.scope,
|
var scope = params.scope,
|
||||||
id = params.id,
|
id = params.id,
|
||||||
callback = params.callback,
|
callback = params.callback,
|
||||||
clear = true;
|
clear = false;
|
||||||
|
|
||||||
// Determine if the tasks and hostResults arrays should be initialized
|
// Determine if the tasks and hostResults arrays should be initialized
|
||||||
//if (scope.search_all_hosts_name || scope.searchAllStatus === 'failed') {
|
if (scope.search_all_hosts_name || scope.searchAllStatus === 'failed') {
|
||||||
// clear = true;
|
clear = true;
|
||||||
//}
|
}
|
||||||
//else {
|
else {
|
||||||
// clear = (scope.activePlay === id) ? false : true; //are we moving to a new play?
|
clear = (scope.activePlay === id) ? false : true; //are we moving to a new play?
|
||||||
|
}
|
||||||
|
|
||||||
if (scope.activePlay && scope.playsMap[scope.activePlay] !== undefined) {
|
if (scope.activePlay && scope.playsMap[scope.activePlay] !== undefined) {
|
||||||
scope.plays[scope.playsMap[scope.activePlay]].playActiveClass = '';
|
scope.plays[scope.playsMap[scope.activePlay]].playActiveClass = '';
|
||||||
@@ -616,10 +613,13 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
|||||||
return function(params) {
|
return function(params) {
|
||||||
var scope = params.scope,
|
var scope = params.scope,
|
||||||
callback = params.callback,
|
callback = params.callback,
|
||||||
|
clear = params.clear,
|
||||||
url;
|
url;
|
||||||
|
|
||||||
scope.tasks = [];
|
if (clear) {
|
||||||
scope.tasksMap = {};
|
scope.tasks = [];
|
||||||
|
scope.tasksMap = {};
|
||||||
|
}
|
||||||
|
|
||||||
if (scope.activePlay) {
|
if (scope.activePlay) {
|
||||||
url = scope.job.url + 'job_tasks/?event_id=' + scope.activePlay;
|
url = scope.job.url + 'job_tasks/?event_id=' + scope.activePlay;
|
||||||
@@ -631,7 +631,7 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
|||||||
Rest.get()
|
Rest.get()
|
||||||
.success(function(data) {
|
.success(function(data) {
|
||||||
data.results.forEach(function(event, idx) {
|
data.results.forEach(function(event, idx) {
|
||||||
var end, elapsed;
|
var task, end, elapsed;
|
||||||
|
|
||||||
if (!scope.plays[scope.playsMap[scope.activePlay]].firstTask) {
|
if (!scope.plays[scope.playsMap[scope.activePlay]].firstTask) {
|
||||||
scope.plays[scope.playsMap[scope.activePlay]].firstTask = event.id;
|
scope.plays[scope.playsMap[scope.activePlay]].firstTask = event.id;
|
||||||
@@ -657,36 +657,64 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
|||||||
elapsed = '00:00:00';
|
elapsed = '00:00:00';
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.tasks.push({
|
if (scope.tasksMap[event.id] !== undefined) {
|
||||||
id: event.id,
|
task = scope.tasks[scope.tasksMap[event.id]];
|
||||||
play_id: scope.activePlay,
|
task.status = ( (event.failed) ? 'failed' : (event.changed) ? 'changed' : 'successful' );
|
||||||
name: event.name,
|
task.modified = event.modified;
|
||||||
status: ( (event.failed) ? 'failed' : (event.changed) ? 'changed' : 'successful' ),
|
task.finished = end;
|
||||||
created: event.created,
|
task.elapsed = elapsed;
|
||||||
modified: event.modified,
|
task.hostCount = (event.host_count) ? event.host_count : 0;
|
||||||
finished: end,
|
task.reportedHosts = (event.reported_hosts) ? event.reported_hosts : 0;
|
||||||
elapsed: elapsed,
|
task.successfulCount = (event.successful_count) ? event.successful_count : 0;
|
||||||
hostCount: (event.host_count) ? event.host_count : 0,
|
task.failedCount = (event.failed_count) ? event.failed_count : 0;
|
||||||
reportedHosts: (event.reported_hosts) ? event.reported_hosts : 0,
|
task.changedCount = (event.changed_count) ? event.changed_count : 0;
|
||||||
successfulCount: (event.successful_count) ? event.successful_count : 0,
|
task.skippedCount = (event.skipped_count) ? event.skipped_count : 0;
|
||||||
failedCount: (event.failed_count) ? event.failed_count : 0,
|
task.taskActiveClass = '';
|
||||||
changedCount: (event.changed_count) ? event.changed_count : 0,
|
}
|
||||||
skippedCount: (event.skipped_count) ? event.skipped_count : 0,
|
else {
|
||||||
taskActiveClass: ''
|
scope.tasks.push({
|
||||||
});
|
id: event.id,
|
||||||
scope.tasksMap[event.id] = scope.tasks.length - 1;
|
play_id: scope.activePlay,
|
||||||
|
name: event.name,
|
||||||
|
status: ( (event.failed) ? 'failed' : (event.changed) ? 'changed' : 'successful' ),
|
||||||
|
created: event.created,
|
||||||
|
modified: event.modified,
|
||||||
|
finished: end,
|
||||||
|
elapsed: elapsed,
|
||||||
|
hostCount: (event.host_count) ? event.host_count : 0,
|
||||||
|
reportedHosts: (event.reported_hosts) ? event.reported_hosts : 0,
|
||||||
|
successfulCount: (event.successful_count) ? event.successful_count : 0,
|
||||||
|
failedCount: (event.failed_count) ? event.failed_count : 0,
|
||||||
|
changedCount: (event.changed_count) ? event.changed_count : 0,
|
||||||
|
skippedCount: (event.skipped_count) ? event.skipped_count : 0,
|
||||||
|
taskActiveClass: ''
|
||||||
|
});
|
||||||
|
scope.tasksMap[event.id] = scope.tasks.length - 1;
|
||||||
|
if (scope.tasks.length > scope.tasksMaxRows) {
|
||||||
|
scope.tasks.shift();
|
||||||
|
}
|
||||||
|
}
|
||||||
SetTaskStyles({
|
SetTaskStyles({
|
||||||
scope: scope,
|
scope: scope,
|
||||||
task_id: event.id
|
task_id: event.id
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//rebuild the index;
|
||||||
|
scope.tasksMap = {};
|
||||||
|
scope.tasks.forEach(function(task, idx) {
|
||||||
|
scope.tasksMap[task.id] = idx;
|
||||||
|
});
|
||||||
|
|
||||||
// set the active task
|
// set the active task
|
||||||
SelectTask({
|
SelectTask({
|
||||||
scope: scope,
|
scope: scope,
|
||||||
id: (scope.tasks.length > 0) ? scope.tasks[scope.tasks.length - 1].id : null,
|
id: (scope.tasks.length > 0) ? scope.tasks[scope.tasks.length - 1].id : null,
|
||||||
callback: callback
|
callback: callback
|
||||||
});
|
});
|
||||||
|
|
||||||
|
scope.$emit('FixTasksScroll');
|
||||||
|
|
||||||
})
|
})
|
||||||
.error(function(data) {
|
.error(function(data) {
|
||||||
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
||||||
@@ -696,6 +724,7 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
|||||||
else {
|
else {
|
||||||
scope.tasks = [];
|
scope.tasks = [];
|
||||||
scope.tasksMap = {};
|
scope.tasksMap = {};
|
||||||
|
$('#tasks-table-detail').mCustomScrollbar("update");
|
||||||
SelectTask({
|
SelectTask({
|
||||||
scope: scope,
|
scope: scope,
|
||||||
id: null,
|
id: null,
|
||||||
@@ -711,14 +740,14 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
|||||||
var scope = params.scope,
|
var scope = params.scope,
|
||||||
id = params.id,
|
id = params.id,
|
||||||
callback = params.callback,
|
callback = params.callback,
|
||||||
clear=true;
|
clear=false;
|
||||||
|
|
||||||
//if (scope.search_all_hosts_name || scope.searchAllStatus === 'failed') {
|
if (scope.search_all_hosts_name || scope.searchAllStatus === 'failed') {
|
||||||
// clear = true;
|
clear = true;
|
||||||
//}
|
}
|
||||||
//else {
|
else {
|
||||||
// clear = (scope.activeTask === id) ? false : true;
|
clear = (scope.activeTask === id) ? false : true;
|
||||||
//}
|
}
|
||||||
|
|
||||||
if (scope.activeTask && scope.tasksMap[scope.activeTask] !== undefined) {
|
if (scope.activeTask && scope.tasksMap[scope.activeTask] !== undefined) {
|
||||||
scope.tasks[scope.tasksMap[scope.activeTask]].taskActiveClass = '';
|
scope.tasks[scope.tasksMap[scope.activeTask]].taskActiveClass = '';
|
||||||
@@ -728,13 +757,6 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
|||||||
}
|
}
|
||||||
scope.activeTask = id;
|
scope.activeTask = id;
|
||||||
|
|
||||||
$('#tasks-table-detail').mCustomScrollbar("update");
|
|
||||||
setTimeout( function() {
|
|
||||||
scope.auto_scroll = true;
|
|
||||||
$('#tasks-table-detail').mCustomScrollbar("scrollTo", "bottom");
|
|
||||||
|
|
||||||
}, 1500);
|
|
||||||
|
|
||||||
LoadHosts({
|
LoadHosts({
|
||||||
scope: scope,
|
scope: scope,
|
||||||
callback: callback,
|
callback: callback,
|
||||||
@@ -744,7 +766,7 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
|||||||
}])
|
}])
|
||||||
|
|
||||||
// Refresh the list of hosts
|
// Refresh the list of hosts
|
||||||
.factory('LoadHosts', ['Rest', 'ProcessErrors', 'SelectHost', function(Rest, ProcessErrors, SelectHost) {
|
.factory('LoadHosts', ['Rest', 'ProcessErrors', function(Rest, ProcessErrors) {
|
||||||
return function(params) {
|
return function(params) {
|
||||||
var scope = params.scope,
|
var scope = params.scope,
|
||||||
callback = params.callback,
|
callback = params.callback,
|
||||||
@@ -766,21 +788,39 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
|||||||
Rest.get()
|
Rest.get()
|
||||||
.success(function(data) {
|
.success(function(data) {
|
||||||
data.results.forEach(function(event) {
|
data.results.forEach(function(event) {
|
||||||
scope.hostResults.push({
|
var result;
|
||||||
id: event.id,
|
if (scope.hostResultsMap[event.id] !== undefined) {
|
||||||
status: ( (event.failed) ? 'failed' : (event.changed) ? 'changed' : 'successful' ),
|
result = scope.hostResults[scope.hostResultsMap[event.id]];
|
||||||
host_id: event.host,
|
result.status = ( (event.failed) ? 'failed' : (event.changed) ? 'changed' : 'successful' );
|
||||||
task_id: event.parent,
|
result.created = event.created;
|
||||||
name: event.event_data.host,
|
result.msg = (event.event_data && event.event_data.res) ? event.event_data.res.msg : '';
|
||||||
created: event.created,
|
}
|
||||||
msg: ( (event.event_data && event.event_data.res) ? event.event_data.res.msg : '' )
|
else {
|
||||||
});
|
scope.hostResults.push({
|
||||||
scope.hostResultsMap[event.id] = scope.hostResults.length - 1;
|
id: event.id,
|
||||||
|
status: ( (event.failed) ? 'failed' : (event.changed) ? 'changed' : 'successful' ),
|
||||||
|
host_id: event.host,
|
||||||
|
task_id: event.parent,
|
||||||
|
name: event.event_data.host,
|
||||||
|
created: event.created,
|
||||||
|
msg: ( (event.event_data && event.event_data.res) ? event.event_data.res.msg : '' )
|
||||||
|
});
|
||||||
|
if (scope.hostResults.length > scope.hostTableRows) {
|
||||||
|
scope.hostResults.shift();
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Rebuild the index
|
||||||
|
scope.hostResultsMap = {};
|
||||||
|
scope.hostResults.forEach(function(result, idx) {
|
||||||
|
scope.hostResultsMap[result.id] = idx;
|
||||||
|
});
|
||||||
|
|
||||||
if (callback) {
|
if (callback) {
|
||||||
scope.$emit(callback);
|
scope.$emit(callback);
|
||||||
}
|
}
|
||||||
SelectHost({ scope: scope });
|
scope.$emit('FixHostResultsScroll');
|
||||||
})
|
})
|
||||||
.error(function(data, status) {
|
.error(function(data, status) {
|
||||||
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
||||||
@@ -793,22 +833,11 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
|||||||
if (callback) {
|
if (callback) {
|
||||||
scope.$emit(callback);
|
scope.$emit(callback);
|
||||||
}
|
}
|
||||||
SelectHost({ scope: scope });
|
$('#hosts-table-detail').mCustomScrollbar("update");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}])
|
}])
|
||||||
|
|
||||||
.factory('SelectHost', [ function() {
|
|
||||||
return function(params) {
|
|
||||||
var scope = params.scope;
|
|
||||||
$('#hosts-table-detail').mCustomScrollbar("update");
|
|
||||||
setTimeout( function() {
|
|
||||||
scope.auto_scroll = true;
|
|
||||||
$('#hosts-table-detail').mCustomScrollbar("scrollTo", "bottom");
|
|
||||||
}, 700);
|
|
||||||
};
|
|
||||||
}])
|
|
||||||
|
|
||||||
// Refresh the list of hosts in the hosts summary section
|
// Refresh the list of hosts in the hosts summary section
|
||||||
.factory('ReloadHostSummaryList', ['Rest', 'ProcessErrors', function(Rest, ProcessErrors) {
|
.factory('ReloadHostSummaryList', ['Rest', 'ProcessErrors', function(Rest, ProcessErrors) {
|
||||||
return function(params) {
|
return function(params) {
|
||||||
@@ -864,11 +893,24 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
|||||||
.factory('LoadHostSummary', [ function() {
|
.factory('LoadHostSummary', [ function() {
|
||||||
return function(params) {
|
return function(params) {
|
||||||
var scope = params.scope,
|
var scope = params.scope,
|
||||||
data = params.data;
|
data = params.data,
|
||||||
scope.host_summary.ok = Object.keys(data.ok).length;
|
host;
|
||||||
scope.host_summary.changed = Object.keys(data.changed).length;
|
scope.host_summary.ok = 0;
|
||||||
scope.host_summary.unreachable = Object.keys(data.dark).length;
|
for (host in data.ok) {
|
||||||
scope.host_summary.failed = Object.keys(data.failures).length;
|
scope.host_summary.ok += data.ok[host];
|
||||||
|
}
|
||||||
|
scope.host_summary.changed = 0;
|
||||||
|
for (host in data.changed) {
|
||||||
|
scope.host_summary.changed += data.changed[host];
|
||||||
|
}
|
||||||
|
scope.host_summary.unreachable = 0;
|
||||||
|
for (host in data.dark) {
|
||||||
|
scope.host_summary.dark += data.dark[host];
|
||||||
|
}
|
||||||
|
scope.host_summary.failed = 0;
|
||||||
|
for (host in data.failures) {
|
||||||
|
scope.host_summary.failed += data.failures[host];
|
||||||
|
}
|
||||||
scope.host_summary.total = scope.host_summary.ok + scope.host_summary.changed +
|
scope.host_summary.total = scope.host_summary.ok + scope.host_summary.changed +
|
||||||
scope.host_summary.unreachable + scope.host_summary.failed;
|
scope.host_summary.unreachable + scope.host_summary.failed;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,12 +3,10 @@
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div id="breadcrumb-container" class="col-md-12" style="position: relative;">
|
<div id="breadcrumb-container" class="col-md-12" style="position: relative;">
|
||||||
<div class="nav-path">
|
<ul class="ansible-breadcrumb" id="breadcrumb-list">
|
||||||
<ul class="breadcrumb" id="breadcrumb-list">
|
<li><a href="/#/jobs">Jobs</a></li>
|
||||||
<li><a href="/#/jobs">Jobs</a></li>
|
<li class="active"><a href="">{{ job_id }} - {{ job.name }}</a></li>
|
||||||
<li><strong>{{ job_id }}</strong> - <a href="{{ job_template_url }}" aw-tool-tip="Edit the job template" data-placement="top">{{ job_template_name }}</a></li>
|
</ul>
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user