mirror of
https://github.com/ansible/awx.git
synced 2026-05-06 17:07:36 -02:30
add workflow jobs to inventory list status popup
This commit is contained in:
@@ -5,9 +5,13 @@ export default [ '$scope', 'Empty', 'Wait', 'GetBasePath', 'Rest', 'ProcessError
|
|||||||
if (!Empty($scope.inventory.id)) {
|
if (!Empty($scope.inventory.id)) {
|
||||||
if ($scope.inventory.total_hosts > 0) {
|
if ($scope.inventory.total_hosts > 0) {
|
||||||
Wait('start');
|
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";
|
url += "&order_by=-finished&page_size=5";
|
||||||
|
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
Rest.get()
|
Rest.get()
|
||||||
.then(({data}) => {
|
.then(({data}) => {
|
||||||
@@ -22,8 +26,14 @@ export default [ '$scope', 'Empty', 'Wait', 'GetBasePath', 'Rest', 'ProcessError
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.viewJob = function(jobId) {
|
$scope.viewJob = function(jobId, type) {
|
||||||
$state.go('output', { id: jobId, type: 'playbook' });
|
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) {
|
data.results.forEach(function(row) {
|
||||||
if ((scope.inventory.has_active_failures && row.status === 'failed') || (!scope.inventory.has_active_failures && row.status === 'successful')) {
|
if ((scope.inventory.has_active_failures && row.status === 'failed') || (!scope.inventory.has_active_failures && row.status === 'successful')) {
|
||||||
html += "<tr>\n";
|
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";
|
". 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>" + ($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>";
|
". Click for details\" aw-tip-placement=\"top\" data-tooltip-outer-class=\"Tooltip-secondary\">" + $filter('sanitize')(ellipsis(row.name)) + "</a></td>";
|
||||||
html += "</tr>\n";
|
html += "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user