mirror of
https://github.com/ansible/awx.git
synced 2026-01-16 12:20:45 -03:30
add workflow jobs to inventory list status popup
This commit is contained in:
parent
fed00a18ad
commit
c6a7d0859d
@ -5,9 +5,13 @@ export default [ '$scope', 'Empty', 'Wait', 'GetBasePath', 'Rest', 'ProcessError
|
||||
if (!Empty($scope.inventory.id)) {
|
||||
if ($scope.inventory.total_hosts > 0) {
|
||||
Wait('start');
|
||||
let url = GetBasePath('jobs') + "?type=job&inventory=" + $scope.inventory.id + "&failed=";
|
||||
url += ($scope.inventory.has_active_failures) ? "true" : "false";
|
||||
|
||||
let url = GetBasePath('unified_jobs') + '?';
|
||||
url += `&or__job__inventory=${$scope.inventory.id}`;
|
||||
url += `&or__workflowjob__inventory=${$scope.inventory.id}`;
|
||||
url += `&failed=${$scope.inventory.has_active_failures ? "true" : "false"}`;
|
||||
url += "&order_by=-finished&page_size=5";
|
||||
|
||||
Rest.setUrl(url);
|
||||
Rest.get()
|
||||
.then(({data}) => {
|
||||
@ -22,8 +26,14 @@ export default [ '$scope', 'Empty', 'Wait', 'GetBasePath', 'Rest', 'ProcessError
|
||||
}
|
||||
};
|
||||
|
||||
$scope.viewJob = function(jobId) {
|
||||
$state.go('output', { id: jobId, type: 'playbook' });
|
||||
$scope.viewJob = function(jobId, type) {
|
||||
let outputType = 'playbook';
|
||||
|
||||
if (type === 'workflow_job') {
|
||||
$state.go('workflowResults', { id: jobId}, { reload: true });
|
||||
} else {
|
||||
$state.go('output', { id: jobId, type: outputType });
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -60,10 +60,10 @@ export default ['templateUrl', 'Wait', '$filter', '$compile', 'i18n',
|
||||
data.results.forEach(function(row) {
|
||||
if ((scope.inventory.has_active_failures && row.status === 'failed') || (!scope.inventory.has_active_failures && row.status === 'successful')) {
|
||||
html += "<tr>\n";
|
||||
html += "<td><a href=\"\" ng-click=\"viewJob(" + row.id + ")\" " + "aw-tool-tip=\"" + row.status.charAt(0).toUpperCase() + row.status.slice(1) +
|
||||
html += "<td><a href=\"\" ng-click=\"viewJob(" + row.id + "," + "'" + row.type + "'" + ")\" " + "aw-tool-tip=\"" + row.status.charAt(0).toUpperCase() + row.status.slice(1) +
|
||||
". Click for details\" aw-tip-placement=\"top\" data-tooltip-outer-class=\"Tooltip-secondary\"><i class=\"fa SmartStatus-tooltip--" + row.status + " icon-job-" + row.status + "\"></i></a></td>\n";
|
||||
html += "<td>" + ($filter('longDate')(row.finished)) + "</td>";
|
||||
html += "<td><a href=\"\" ng-click=\"viewJob(" + row.id + ")\" " + "aw-tool-tip=\"" + row.status.charAt(0).toUpperCase() + row.status.slice(1) +
|
||||
html += "<td><a href=\"\" ng-click=\"viewJob(" + row.id + "," + "'" + row.type + "'" + ")\" " + "aw-tool-tip=\"" + row.status.charAt(0).toUpperCase() + row.status.slice(1) +
|
||||
". Click for details\" aw-tip-placement=\"top\" data-tooltip-outer-class=\"Tooltip-secondary\">" + $filter('sanitize')(ellipsis(row.name)) + "</a></td>";
|
||||
html += "</tr>\n";
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user