Chris Houseknecht
2014-08-14 14:36:08 -04:00
parent 5e898f1878
commit 038a1cfb95
2 changed files with 174 additions and 159 deletions

View File

@@ -222,10 +222,12 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar
} }
scope.removeLoadHosts = scope.$on('LoadHosts', function() { scope.removeLoadHosts = scope.$on('LoadHosts', function() {
if (scope.activeTask) { if (scope.activeTask) {
var play = scope.jobData.plays[scope.activePlay], var play = scope.jobData.plays[scope.activePlay],
task = play.tasks[scope.activeTask], task = play.tasks[scope.activeTask],
url; url;
if (play && task) {
url = scope.job.related.job_events + '?parent=' + task.id + '&'; url = scope.job.related.job_events + '?parent=' + task.id + '&';
url += 'event__startswith=runner&page_size=' + scope.hostResultsMaxRows + '&order_by=-host__name'; url += 'event__startswith=runner&page_size=' + scope.hostResultsMaxRows + '&order_by=-host__name';
@@ -301,8 +303,11 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar
ProcessErrors(scope, data, status, null, { hdr: 'Error!', ProcessErrors(scope, data, status, null, { hdr: 'Error!',
msg: 'Call to ' + url + '. GET returned: ' + status }); msg: 'Call to ' + url + '. GET returned: ' + status });
}); });
} else {
console.log('no tasks loaded!');
scope.$emit('LoadHostSummaries');
} }
else { } else {
scope.$emit('LoadHostSummaries'); scope.$emit('LoadHostSummaries');
} }
}); });
@@ -314,6 +319,7 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar
if (scope.activePlay) { if (scope.activePlay) {
var play = scope.jobData.plays[scope.activePlay], url; var play = scope.jobData.plays[scope.activePlay], url;
if (play) {
url = scope.job.url + 'job_tasks/?event_id=' + play.id; url = scope.job.url + 'job_tasks/?event_id=' + play.id;
url += '&page_size=' + scope.tasksMaxRows + '&order_by=id'; url += '&page_size=' + scope.tasksMaxRows + '&order_by=id';
@@ -386,7 +392,10 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar
// this is not the first task // this is not the first task
play.tasks[event.id].hostCount = play.tasks[play.firstTask].hostCount; play.tasks[event.id].hostCount = play.tasks[play.firstTask].hostCount;
} }
if (play.tasks[event.id].hostCount === 0) { if (play.tasks[event.id].reportedHosts === 0 && play.tasks[event.id].successfulCount === 0 &&
play.tasks[event.id].failedCount === 0 && play.tasks[event.id].changedCount === 0 &&
play.tasks[event.id].skippedCount === 0 && play.tasks[event.id].unreachableCount === 0) {
play.tasks[event.id].status = 'no-matching-hosts';
play.tasks[event.id].status_text = 'No matching hosts'; play.tasks[event.id].status_text = 'No matching hosts';
play.tasks[event.id].status_tip = "Event ID: " + event.id + "<br />Status: No matching hosts"; play.tasks[event.id].status_tip = "Event ID: " + event.id + "<br />Status: No matching hosts";
} }
@@ -404,8 +413,10 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar
ProcessErrors(scope, data, status, null, { hdr: 'Error!', ProcessErrors(scope, data, status, null, { hdr: 'Error!',
msg: 'Call to ' + url + '. GET returned: ' + status }); msg: 'Call to ' + url + '. GET returned: ' + status });
}); });
} else {
scope.$emit('LoadHostSummaries');
} }
else { } else {
scope.$emit('LoadHostSummaries'); scope.$emit('LoadHostSummaries');
} }
}); });
@@ -502,6 +513,7 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar
} }
if (scope.jobData.plays[event.id].hostCount === 0 && event.unreachable_count === 0) { if (scope.jobData.plays[event.id].hostCount === 0 && event.unreachable_count === 0) {
scope.jobData.plays[event.id].status = 'no-matching-hosts';
scope.jobData.plays[event.id].status_text = 'No matching hosts'; scope.jobData.plays[event.id].status_text = 'No matching hosts';
scope.jobData.plays[event.id].status_tip = "Event ID: " + event.id + "<br />Status: No matching hosts"; scope.jobData.plays[event.id].status_tip = "Event ID: " + event.id + "<br />Status: No matching hosts";
} }

View File

@@ -391,10 +391,11 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
} }
else if (play.status !== 'changed' && play.status !== 'failed') { else if (play.status !== 'changed' && play.status !== 'failed') {
// once the status becomes 'changed' or 'failed' don't modify it // once the status becomes 'changed' or 'failed' don't modify it
play.status = (changed) ? 'changed' : (failed) ? 'failed' : 'successful';
if (no_hosts) { if (no_hosts) {
play.status = 'no-matching-hosts';
play.status_text = 'No matching hosts'; play.status_text = 'No matching hosts';
} else { } else {
play.status = (changed) ? 'changed' : (failed) ? 'failed' : 'successful';
play.status_text = (changed) ? 'Changed' : (failed) ? 'Failed' : 'OK'; play.status_text = (changed) ? 'Changed' : (failed) ? 'Failed' : 'OK';
} }
} }
@@ -1259,7 +1260,7 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
filteredListX = [], filteredListX = [],
filteredListA = [], filteredListA = [],
filteredListB = [], filteredListB = [],
idx, key, keys, newKeys, tasks; idx, key, keys, newKeys, tasks, t;
function listSort(a,b) { function listSort(a,b) {
if (parseInt(a,10) < parseInt(b,10)) if (parseInt(a,10) < parseInt(b,10))
@@ -1275,7 +1276,9 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
// Only draw tasks that are in the 'active' list // Only draw tasks that are in the 'active' list
for (key in tasks) { for (key in tasks) {
if (tasks[key].reportedHosts > 0 || tasks[key].status === 'no-matching-hosts') { t = tasks[key];
if (t.reportedHosts > 0 || t.hostCount > 0 || t.successfulCount >0 || t.failedCount > 0 ||
t.changedCount > 0 || t.skippedCount > 0 || t.unreachableCount > 0) {
filteredListX[key] = tasks[key]; filteredListX[key] = tasks[key];
} }
} }