mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 18:09:57 -03:30
fixed live updating of tooltips on job detail page
This commit is contained in:
parent
6462d14ace
commit
406d7a6b74
@ -11,7 +11,7 @@
|
||||
*/
|
||||
|
||||
|
||||
export function JobDetailController ($location, $rootScope, $scope, $compile, $routeParams, $log, ClearScope, Breadcrumbs, LoadBreadCrumbs, GetBasePath, Wait, Rest,
|
||||
export function JobDetailController ($location, $rootScope, $filter, $scope, $compile, $routeParams, $log, ClearScope, Breadcrumbs, LoadBreadCrumbs, GetBasePath, Wait, Rest,
|
||||
ProcessErrors, SelectPlay, SelectTask, Socket, GetElapsed, DrawGraph, LoadHostSummary, ReloadHostSummaryList, JobIsFinished, SetTaskStyles, DigestEvent,
|
||||
UpdateDOM, EventViewer, DeleteJob, PlaybookRun, HostEventsViewer, LoadPlays, LoadTasks, LoadHosts, HostsEdit, ParseVariableString, GetChoices) {
|
||||
|
||||
@ -26,8 +26,101 @@ export function JobDetailController ($location, $rootScope, $scope, $compile, $r
|
||||
job_type_options;
|
||||
|
||||
scope.plays = [];
|
||||
|
||||
scope.$watch('plays', function(plays) {
|
||||
for (var play in plays) {
|
||||
if (plays[play].elapsed) {
|
||||
plays[play].finishedTip = "Play completed at " + $filter("longDate")(plays[play].finished) + ".";
|
||||
} else {
|
||||
plays[play].finishedTip = "Play not completed.";
|
||||
}
|
||||
}
|
||||
});
|
||||
scope.hosts = [];
|
||||
scope.$watch('hosts', function(hosts) {
|
||||
for (var host in hosts) {
|
||||
if (hosts[host].ok) {
|
||||
hosts[host].okTip = hosts[host].ok;
|
||||
hosts[host].okTip += (hosts[host].ok === 1) ? " host was" : " hosts were";
|
||||
hosts[host].okTip += " successful during this run.";
|
||||
} else {
|
||||
hosts[host].okTip = "No hosts were successful during this run.";
|
||||
}
|
||||
if (hosts[host].changed) {
|
||||
hosts[host].changedTip = hosts[host].changed;
|
||||
hosts[host].changedTip += (hosts[host].changed === 1) ? " host" : " hosts";
|
||||
hosts[host].changedTip += " changed during this run.";
|
||||
} else {
|
||||
hosts[host].changedTip = "No hosts changed during this run.";
|
||||
}
|
||||
if (hosts[host].failed) {
|
||||
hosts[host].failedTip = hosts[host].failed;
|
||||
hosts[host].failedTip += (hosts[host].failed === 1) ? " host" : " hosts";
|
||||
hosts[host].failedTip += " failed during this run.";
|
||||
} else {
|
||||
hosts[host].failedTip = "No hosts failed during this run.";
|
||||
}
|
||||
if (hosts[host].unreachable) {
|
||||
hosts[host].unreachableTip = hosts[host].unreachable;
|
||||
hosts[host].unreachableTip += (hosts[host].unreachable === 1) ? " host was" : " hosts were";
|
||||
hosts[host].unreachableTip += " unreachable during this run";
|
||||
} else {
|
||||
hosts[host].unreachableTip = "No hosts were unreachable during this run.";
|
||||
}
|
||||
}
|
||||
});
|
||||
scope.tasks = [];
|
||||
scope.$watch('tasks', function(tasks) {
|
||||
for (var task in tasks) {
|
||||
if (tasks[task].elapsed) {
|
||||
tasks[task].finishedTip = "Task completed at " + $filter("longDate")(tasks[task].finished) + ".";
|
||||
} else {
|
||||
tasks[task].finishedTip = "Task not completed.";
|
||||
}
|
||||
if (tasks[task].successfulCount) {
|
||||
tasks[task].successfulCountTip = tasks[task].successfulCount;
|
||||
tasks[task].successfulCountTip += (tasks[task].successfulCount === 1) ? " host was" : " hosts were";
|
||||
tasks[task].successfulCountTip += " successful during this run.";
|
||||
} else {
|
||||
tasks[task].successfulCountTip = "No hosts were successful during this run.";
|
||||
}
|
||||
if (tasks[task].changedCount) {
|
||||
tasks[task].changedCountTip = tasks[task].changedCount;
|
||||
tasks[task].changedCountTip += (tasks[task].changedCount === 1) ? " host" : " hosts";
|
||||
tasks[task].changedCountTip += " changed during this run.";
|
||||
} else {
|
||||
tasks[task].changedCountTip = "No hosts changed during this run.";
|
||||
}
|
||||
if (tasks[task].skippedCount) {
|
||||
tasks[task].skippedCountTip = tasks[task].skippedCount;
|
||||
tasks[task].skippedCountTip += (tasks[task].skippedCount === 1) ? " host was" : " hosts were";
|
||||
tasks[task].skippedCountTip += " skipped during this run.";
|
||||
} else {
|
||||
tasks[task].skippedCountTip = "No hosts were skipped during this run.";
|
||||
}
|
||||
if (tasks[task].failedCount) {
|
||||
tasks[task].failedCountTip = tasks[task].failedCount;
|
||||
tasks[task].failedCountTip += (tasks[task].failedCount === 1) ? " host" : " hosts";
|
||||
tasks[task].failedCountTip += " failed during this run.";
|
||||
} else {
|
||||
tasks[task].failedCountTip = "No hosts failed during this run.";
|
||||
}
|
||||
if (tasks[task].unreachableCount) {
|
||||
tasks[task].unreachableCountTip = tasks[task].unreachableCount;
|
||||
tasks[task].unreachableCountTip += (tasks[task].unreachableCount === 1) ? " host was" : " hosts were";
|
||||
tasks[task].unreachableCountTip += " unreachable during this run.";
|
||||
} else {
|
||||
tasks[task].unreachableCountTip = "No hosts were unreachable during this run.";
|
||||
}
|
||||
if (tasks[task].missingCount) {
|
||||
tasks[task].missingCountTip = tasks[task].missingCount;
|
||||
tasks[task].missingCountTip += (tasks[task].missingCount === 1) ? " host was" : " hosts were";
|
||||
tasks[task].missingCountTip += " missing during this run.";
|
||||
} else {
|
||||
tasks[task].missingCountTip = "No hosts were missing during this run.";
|
||||
}
|
||||
}
|
||||
});
|
||||
scope.hostResults = [];
|
||||
|
||||
scope.hostResultsMaxRows = 200;
|
||||
@ -1311,7 +1404,7 @@ export function JobDetailController ($location, $rootScope, $scope, $compile, $r
|
||||
};
|
||||
}
|
||||
|
||||
JobDetailController.$inject = [ '$location', '$rootScope', '$scope', '$compile', '$routeParams', '$log', 'ClearScope', 'Breadcrumbs', 'LoadBreadCrumbs', 'GetBasePath',
|
||||
JobDetailController.$inject = [ '$location', '$rootScope', '$filter', '$scope', '$compile', '$routeParams', '$log', 'ClearScope', 'Breadcrumbs', 'LoadBreadCrumbs', 'GetBasePath',
|
||||
'Wait', 'Rest', 'ProcessErrors', 'SelectPlay', 'SelectTask', 'Socket', 'GetElapsed', 'DrawGraph', 'LoadHostSummary', 'ReloadHostSummaryList',
|
||||
'JobIsFinished', 'SetTaskStyles', 'DigestEvent', 'UpdateDOM', 'EventViewer', 'DeleteJob', 'PlaybookRun', 'HostEventsViewer', 'LoadPlays', 'LoadTasks',
|
||||
'LoadHosts', 'HostsEdit', 'ParseVariableString', 'GetChoices'
|
||||
|
||||
@ -187,7 +187,7 @@
|
||||
<tbody>
|
||||
<tr class="cursor-pointer" ng-repeat="play in plays" ng-class="play.playActiveClass" ng-click="selectPlay(play.id, $event)">
|
||||
<td class="col-lg-2 col-md-2 col-sm-2 col-xs-3">{{ play.created | date: 'HH:mm:ss' }}</td>
|
||||
<td class="col-lg-2 col-md-2 col-sm-2 col-xs-3" aw-tool-tip="Completed at {{ play.finished | date:'HH:mm:ss' }}"
|
||||
<td class="col-lg-2 col-md-2 col-sm-2 col-xs-3" aw-tool-tip="{{ play.finishedTip }}" data-tip-watch="play.finishedTip"
|
||||
data-placement="top">{{ play.elapsed }}</td>
|
||||
<td class="col-lg-1 col-md-2 col-sm-2 col-xs-2 status-column" aw-tool-tip="{{ play.status_tip }}" data-tip-watch="play.status_tip" data-placement="top"><i class="fa icon-job-{{ play.status }}"></i></td>
|
||||
<td class="col-lg-7 col-md-6 col-sm-6 col-xs-4">{{ play.name }}</td>
|
||||
@ -252,33 +252,33 @@
|
||||
<tbody>
|
||||
<tr class="cursor-pointer" ng-repeat="task in taskList = (tasks) track by $index" ng-class="task.taskActiveClass" ng-click="selectTask(task.id)">
|
||||
<td class="col-lg-2 col-md-2 col-sm-2 col-xs-3">{{ task.created | date: 'HH:mm:ss' }}</td>
|
||||
<td class="col-lg-2 col-md-2 col-sm-2 col-xs-3" aw-tool-tip="Completed at {{ task.finished | date:'HH:mm:ss' }}"
|
||||
<td class="col-lg-2 col-md-2 col-sm-2 col-xs-3" aw-tool-tip="{{ task.finishedTip }}" data-tip-watch="task.finishedTip"
|
||||
data-placement="top">{{ task.elapsed }}</td>
|
||||
<td class="col-lg-1 col-md-2 col-sm-2 col-xs-2 status-column" aw-tool-tip="{{ task.status_tip }}"
|
||||
data-tip-watch="task.status_tip" data-placement="top"><i class="fa icon-job-{{ task.status }}"></i></td>
|
||||
<td class="col-lg-3 col-md-3 col-sm-6 col-xs-4" id="">{{ task.name }}</td>
|
||||
<td class="col-lg-4 col-md-3 hidden-sm hidden-xs">
|
||||
<div class="status-bar">
|
||||
<div class="successful-hosts inner-bar" id="{{ task.id }}-successful-bar" aw-tool-tip="{{ task.successfulCount }} Hosts OK" data-placement="top" ng-style="task.successfulStyle">
|
||||
<div class="successful-hosts inner-bar" id="{{ task.id }}-successful-bar" aw-tool-tip="{{ task.successfulCountTip }}" data-tip-watch="task.successfulCountTip" data-placement="top" ng-style="task.successfulStyle">
|
||||
{{ task.successfulCount }}
|
||||
</div>
|
||||
<div class="changed-hosts inner-bar" id="{{ task.id }}-changed-bar" aw-tool-tip="{{ task.changedCount }} Hosts Changed" data-placement="top" ng-style="task.changedStyle">
|
||||
<div class="changed-hosts inner-bar" id="{{ task.id }}-changed-bar" aw-tool-tip="{{ task.changedCountTip }}" data-tip-watch="task.changedCountTip" data-placement="top" ng-style="task.changedStyle">
|
||||
{{ task.changedCount }}
|
||||
</div>
|
||||
<div class="skipped-hosts inner-bar" id="{{ task.id }}-skipped-bar" aw-tool-tip="{{ task.skippedCount }} Hosts Skipped" data-placement="top" ng-style="task.skippedStyle">
|
||||
<div class="skipped-hosts inner-bar" id="{{ task.id }}-skipped-bar" aw-tool-tip="{{ task.skippedCountTip }}" data-tip-watch="task.skippedCountTip" data-placement="top" ng-style="task.skippedStyle">
|
||||
{{ task.skippedCount }}
|
||||
</div>
|
||||
<div class="failed-hosts inner-bar" id="{{ task.id }}-failed-bar" aw-tool-tip="{{ task.failedCount }} Hosts Failed" data-placement="top" ng-style="task.failedStyle">
|
||||
<div class="failed-hosts inner-bar" id="{{ task.id }}-failed-bar" aw-tool-tip="{{ task.failedCountTip }}" data-tip-watch="task.failedCountTip" data-placement="top" ng-style="task.failedStyle">
|
||||
{{ task.failedCount }}
|
||||
</div>
|
||||
<div class="unreachable-hosts inner-bar" id="{{ task.id }}-unreachable-hosts-bar" aw-tool-tip="{{ task.unreachableCount }} Hosts Unreachable" data-placement="top" ng-style="task.unreachableStyle">
|
||||
<div class="unreachable-hosts inner-bar" id="{{ task.id }}-unreachable-hosts-bar" aw-tool-tip="{{ task.unreachableCountTip }}" data-tip-watch="task.unreachableCountTip" data-placement="top" ng-style="task.unreachableStyle">
|
||||
{{ task.unreachableCount }}
|
||||
</div>
|
||||
<div class="missing-hosts inner-bar" id="{{ task.id }}-misssing-hosts-bar" aw-tool-tip="{{ task.missingCount }} Hosts Missing" data-placement="top" ng-style="task.missingStyle">
|
||||
<div class="missing-hosts inner-bar" id="{{ task.id }}-misssing-hosts-bar" aw-tool-tip="{{ task.missingCountTip }}" data-tip-watch="task.missingCountTip" data-placement="top" ng-style="task.missingStyle">
|
||||
{{ task.missingCount }}
|
||||
</div>
|
||||
<div class="no-matching-hosts inner-bar" id="{{ task.id }}-{{ task.play_id }}-no-matching-hosts-bar" aw-tool-tip="No matching hosts were found" data-placement="top" style="width: 100%;" ng-show="task.status === 'no-matching-hosts'">
|
||||
No matching hosts
|
||||
<div class="no-matching-hosts inner-bar" id="{{ task.id }}-{{ task.play_id }}-no-matching-hosts-bar" aw-tool-tip="No matching hosts were found during this run." data-placement="top" style="width: 100%;" ng-show="task.status === 'no-matching-hosts'">
|
||||
No matching hosts.
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@ -425,10 +425,10 @@
|
||||
<tr ng-repeat="host in summaryList = (hosts) track by $index" id="{{ host.id }}">
|
||||
<td class="name col-lg-6 col-md-6 col-sm-6 col-xs-6"><a href="" ng-click="hostEventsViewer(host.id, host.name)" aw-tool-tip="View all events" data-placement="top">{{ host.name }}</a></td>
|
||||
<td class="col-lg-5 col-md-5 col-sm-5 col-xs-5 badge-column">
|
||||
<a href="" ng-click="hostEventsViewer(host.id, host.name, 'ok')" aw-tool-tip="{{ host.ok }} Hosts Okay" data-placement="top" ng-hide="host.ok == 0"><span class="badge successful-hosts">{{ host.ok }}</span></a>
|
||||
<a href="" ng-click="hostEventsViewer(host.id, host.name, 'changed')" aw-tool-tip="{{ host.changed }} Hosts Changed" data-placement="top" ng-hide="host.changed == 0"><span class="badge changed-hosts">{{ host.changed }}</span></a>
|
||||
<a href="" ng-click="hostEventsViewer(host.id, host.name, 'unreachable')" aw-tool-tip="{{ host.unreachable }} Hosts Unreachable" data-placement="top" ng-hide="host.unreachable == 0"><span class="badge unreachable-hosts">{{ host.unreachable }}</span></a>
|
||||
<a href="" ng-click="hostEventsViewer(host.id, host.name, 'failed')" aw-tool-tip="{{ host.failed }} Hosts Failed" data-placement="top" ng-hide="host.failed == 0"><span class="badge failed-hosts">{{ host.failed }}</span></a></td>
|
||||
<a href="" ng-click="hostEventsViewer(host.id, host.name, 'ok')" aw-tool-tip="{{ host.okTip }}" data-tip-watch="host.okTip" data-placement="top" ng-hide="host.ok == 0"><span class="badge successful-hosts">{{ host.ok }}</span></a>
|
||||
<a href="" ng-click="hostEventsViewer(host.id, host.name, 'changed')" aw-tool-tip="{{ host.changedTip }}" data-tip-watch="host.changedTip" data-placement="top" ng-hide="host.changed == 0"><span class="badge changed-hosts">{{ host.changed }}</span></a>
|
||||
<a href="" ng-click="hostEventsViewer(host.id, host.name, 'unreachable')" aw-tool-tip="{{ host.unreachableTip }}" data-tip-watch="host.unreachableTip" data-placement="top" ng-hide="host.unreachable == 0"><span class="badge unreachable-hosts">{{ host.unreachable }}</span></a>
|
||||
<a href="" ng-click="hostEventsViewer(host.id, host.name, 'failed')" aw-tool-tip="{{ host.failedTip }}" data-tip-watch="host.failedTip" data-placement="top" ng-hide="host.failed == 0"><span class="badge failed-hosts">{{ host.failed }}</span></a></td>
|
||||
<td class="col-lg-1 col-md-1 col-sm-1 col-xs-1"><a ng-show="host.id" href="" ng-click="editHost(host.id)" aw-tool-tip="Edit host" data-placement="top"><i class="fa fa-pencil"></i></a></td>
|
||||
</tr>
|
||||
<tr ng-show="summaryList.length === 0 && waiting">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user