Job detail page refactor

Re-enabling a count of the possible hosts that should report status on each task. As live events happen increment a count stored on the play. Only increment when hosts are reporting for the first task of the play, and only increment if the host status is in: successful, changed, skipped or failed. Added the total to the plays list as 'Reporting Hosts'.
This commit is contained in:
Chris Houseknecht
2014-06-25 16:24:30 -04:00
parent 8c502478a0
commit 3516ad4b98
4 changed files with 38 additions and 25 deletions

View File

@@ -239,7 +239,7 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
hostResults: {}
};
if (!scope.jobData.plays[scope.activePlay].firstTask) {
if (scope.jobData.plays[scope.activePlay].firstTask === undefined || scope.jobData.plays[scope.activePlay].firstTask === null) {
scope.jobData.plays[scope.activePlay].firstTask = event.id;
}
@@ -458,10 +458,10 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
if (scope.jobData.plays[scope.activePlay].tasks[task_id] !== undefined) {
task = scope.jobData.plays[scope.activePlay].tasks[task_id];
//if (task_id === scope.jobData.plays[scope.activePlay].firstTask) {
// scope.jobData.plays[scope.activePlay].hostCount++;
// task.hostCount++;
//}
if (task_id === scope.jobData.plays[scope.activePlay].firstTask && status !== 'unreachable') {
scope.jobData.plays[scope.activePlay].hostCount++;
task.hostCount++;
}
task.reportedHosts += 1;
task.failedCount += (status === 'failed' || status === 'unreachable') ? 1 : 0;
@@ -481,7 +481,7 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
diff;
//task = scope.jobData.plays[scope.activePlay].tasks[task_id];
task.hostCount = task.failedCount + task.changedCount + task.skippedCount + task.successfulCount;
//task.hostCount = task.failedCount + task.changedCount + task.skippedCount + task.successfulCount;
task.failedPct = (task.hostCount > 0) ? Math.ceil((100 * (task.failedCount / task.hostCount))) : 0;
task.changedPct = (task.hostCount > 0) ? Math.ceil((100 * (task.changedCount / task.hostCount))) : 0;
task.skippedPct = (task.hostCount > 0) ? Math.ceil((100 * (task.skippedCount / task.hostCount))) : 0;