mirror of
https://github.com/ansible/awx.git
synced 2026-02-26 15:36:04 -03:30
Job details page re-refactor continues...
Started adding logic to support parallel processing of plays/tasks. Fixed summary host lit not loading when there is no active play and/or active task. Now using jobs/N/job_host_summaries.host_name when building host summary list.
This commit is contained in:
@@ -149,8 +149,8 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar
|
|||||||
.success(function(data) {
|
.success(function(data) {
|
||||||
data.results.forEach(function(event) {
|
data.results.forEach(function(event) {
|
||||||
var name;
|
var name;
|
||||||
if (event.summary_fields.host && event.summary_fields.host.name) {
|
if (event.host_name) {
|
||||||
name = event.summary_fields.host.name;
|
name = event.host_name;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
name = "<deleted host>";
|
name = "<deleted host>";
|
||||||
@@ -236,8 +236,7 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
scope.jobData.hostSummaries = {};
|
scope.$emit('LoadHostSummaries');
|
||||||
scope.$emit('InitialLoadComplete');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -322,9 +321,9 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar
|
|||||||
task: play.tasks[event.id]
|
task: play.tasks[event.id]
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
//if (scope.activeTask) {
|
if (scope.activeTask) {
|
||||||
// scope.jobData.plays[scope.activePlay].tasks[scope.activeTask].taskActiveClass = 'active';
|
scope.jobData.plays[scope.activePlay].tasks[scope.activeTask].taskActiveClass = 'active';
|
||||||
//}
|
}
|
||||||
scope.$emit('LoadHosts');
|
scope.$emit('LoadHosts');
|
||||||
})
|
})
|
||||||
.error(function(data) {
|
.error(function(data) {
|
||||||
@@ -333,8 +332,7 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
scope.jobData.hostSummaries = {};
|
scope.$emit('LoadHostSummaries');
|
||||||
scope.$emit('InitialLoadComplete');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -425,7 +423,6 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar
|
|||||||
scope.jobData.plays[scope.activePlay].playActiveClass = 'active';
|
scope.jobData.plays[scope.activePlay].playActiveClass = 'active';
|
||||||
}
|
}
|
||||||
scope.$emit('LoadTasks', events_url);
|
scope.$emit('LoadTasks', 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!',
|
||||||
@@ -850,8 +847,8 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar
|
|||||||
var url = scope.job.url + 'job_plays/?id__gt=' + scope.plays[scope.plays.length - 1].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_name) ? '&play__icontains=' + scope.search_play_name : '';
|
||||||
url += (scope.search_play_status === 'failed') ? '&failed=true' : '';
|
url += (scope.search_play_status === 'failed') ? '&failed=true' : '';
|
||||||
url += + '&page_size=' + scope.playsMaxRows + '&order_by=id';
|
url += '&page_size=' + scope.playsMaxRows + '&order_by=id';
|
||||||
|
$('#playsMoreRows').fadeIn();
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
Rest.get()
|
Rest.get()
|
||||||
.success( function(data) {
|
.success( function(data) {
|
||||||
@@ -902,6 +899,7 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar
|
|||||||
|
|
||||||
scope.plays[scope.plays.length - 1].hostCount = ok + changed + failed + skipped;
|
scope.plays[scope.plays.length - 1].hostCount = ok + changed + failed + skipped;
|
||||||
});
|
});
|
||||||
|
$('#playsMoreRows').fadeOut(400);
|
||||||
})
|
})
|
||||||
.error( function(data, status) {
|
.error( function(data, status) {
|
||||||
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
||||||
@@ -914,7 +912,7 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar
|
|||||||
// check for more tasks when user scrolls to bottom of task list...
|
// check for more tasks when user scrolls to bottom of task list...
|
||||||
if ((!scope.liveEventProcessing) && scope.activePlay && scope.tasks.length) {
|
if ((!scope.liveEventProcessing) && scope.activePlay && scope.tasks.length) {
|
||||||
var url = scope.job.url + 'job_tasks/?event_id=' + scope.activePlay;
|
var url = scope.job.url + 'job_tasks/?event_id=' + scope.activePlay;
|
||||||
url += (scope.search_task_name) ? '&name__icontains=' + scope.search_task_name : '';
|
url += (scope.search_task_name) ? '&task__icontains=' + scope.search_task_name : '';
|
||||||
url += (scope.search_task_status === 'failed') ? '&failed=true' : '';
|
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';
|
url += '&id__gt=' + scope.tasks[scope.tasks.length - 1].id + '&page_size=' + scope.tasksMaxRows + '&order_by=id';
|
||||||
$('#tasksMoreRows').fadeIn();
|
$('#tasksMoreRows').fadeIn();
|
||||||
@@ -1056,8 +1054,8 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar
|
|||||||
.success(function(data) {
|
.success(function(data) {
|
||||||
data.results.forEach(function(row) {
|
data.results.forEach(function(row) {
|
||||||
var name;
|
var name;
|
||||||
if (event.summary_fields.host && event.summary_fields.host.name) {
|
if (event.host_name) {
|
||||||
name = event.summary_fields.host.name;
|
name = event.host_name;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
name = "<deleted host>";
|
name = "<deleted host>";
|
||||||
|
|||||||
@@ -46,8 +46,7 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
|||||||
return function(params) {
|
return function(params) {
|
||||||
|
|
||||||
var scope = params.scope,
|
var scope = params.scope,
|
||||||
event = params.event,
|
event = params.event;
|
||||||
status, status_text;
|
|
||||||
|
|
||||||
$log.debug('processing event: ' + event.id);
|
$log.debug('processing event: ' + event.id);
|
||||||
|
|
||||||
@@ -216,7 +215,7 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
|||||||
if (scope.jobData.plays[key].taskCount > 0) {
|
if (scope.jobData.plays[key].taskCount > 0) {
|
||||||
activeList.push(key);
|
activeList.push(key);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
//find the most recent play in the list of 'active' plays
|
//find the most recent play in the list of 'active' plays
|
||||||
if (scope.activeList.length > 0) {
|
if (scope.activeList.length > 0) {
|
||||||
@@ -275,9 +274,10 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
|||||||
if (scope.jobData.plays[scope.activePlay].tasks[key].reportedHosts > 0 || scope.jobData.plays[scope.activePlay].tasks[key].status === 'no-matching-hosts') {
|
if (scope.jobData.plays[scope.activePlay].tasks[key].reportedHosts > 0 || scope.jobData.plays[scope.activePlay].tasks[key].status === 'no-matching-hosts') {
|
||||||
activeList.push(key);
|
activeList.push(key);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
if (scope.activeList.length > 0) {
|
if (scope.activeList.length > 0) {
|
||||||
newActiveTask = scope.jobData.plays[scope.activePlay].tasks[scope.acitveList[scope.activeList.length - 1]].id
|
newActiveTask = scope.jobData.plays[scope.activePlay].tasks[scope.acitveList[scope.activeList.length - 1]].id;
|
||||||
if (scope.activeTask && newActiveTask !== scope.activeTask) {
|
if (scope.activeTask && newActiveTask !== scope.activeTask) {
|
||||||
if (scope.activeTask && scope.jobData.plays[scope.activePlay].tasks[scope.activeTask] !== undefined) {
|
if (scope.activeTask && scope.jobData.plays[scope.activePlay].tasks[scope.activeTask] !== undefined) {
|
||||||
scope.jobData.plays[scope.activePlay].tasks[scope.activeTask].taskActiveClass = '';
|
scope.jobData.plays[scope.activePlay].tasks[scope.activeTask].taskActiveClass = '';
|
||||||
@@ -647,9 +647,6 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
if (scope.liveEventProcessing) {
|
|
||||||
|
|
||||||
}
|
|
||||||
// set the active task
|
// set the active task
|
||||||
SelectPlay({
|
SelectPlay({
|
||||||
scope: scope,
|
scope: scope,
|
||||||
@@ -701,7 +698,7 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
|||||||
|
|
||||||
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;
|
||||||
url += (scope.search_task_name) ? '&name__icontains=' + scope.search_task_name : '';
|
url += (scope.search_task_name) ? '&task__icontains=' + scope.search_task_name : '';
|
||||||
url += (scope.search_task_status === 'failed') ? '&failed=true' : '';
|
url += (scope.search_task_status === 'failed') ? '&failed=true' : '';
|
||||||
url += '&page_size=' + scope.tasksMaxRows + '&order_by=id';
|
url += '&page_size=' + scope.tasksMaxRows + '&order_by=id';
|
||||||
|
|
||||||
@@ -926,8 +923,8 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
|||||||
.success(function(data) {
|
.success(function(data) {
|
||||||
data.results.forEach(function(event) {
|
data.results.forEach(function(event) {
|
||||||
var name;
|
var name;
|
||||||
if (event.summary_fields.host && event.summary_fields.host.name) {
|
if (event.host_name) {
|
||||||
name = event.summary_fields.host.name;
|
name = event.host_name;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
name = "<deleted host>";
|
name = "<deleted host>";
|
||||||
@@ -1228,11 +1225,9 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
|||||||
idx = 0,
|
idx = 0,
|
||||||
hostSummaries,
|
hostSummaries,
|
||||||
key,
|
key,
|
||||||
keys;
|
keys = Object.keys(scope.jobData.hostSummaries);
|
||||||
|
if (keys.length > 0) {
|
||||||
if (scope.activePlay && scope.activeTask) {
|
|
||||||
hostSummaries = JSON.parse(JSON.stringify(scope.jobData.hostSummaries));
|
hostSummaries = JSON.parse(JSON.stringify(scope.jobData.hostSummaries));
|
||||||
|
|
||||||
if (scope.search_host_summary_name) {
|
if (scope.search_host_summary_name) {
|
||||||
for (key in hostSummaries) {
|
for (key in hostSummaries) {
|
||||||
if (hostSummaries[key].name.indexOf(scope.search_host_summary_name) > 0) {
|
if (hostSummaries[key].name.indexOf(scope.search_host_summary_name) > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user