add workflow jobs to inventory list status popup

This commit is contained in:
Jake McDermott 2018-11-17 15:41:50 -05:00
parent fed00a18ad
commit c6a7d0859d
No known key found for this signature in database
GPG Key ID: 9A6F084352C3A0B7
2 changed files with 16 additions and 6 deletions

View File

@ -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 });
}
};
}

View File

@ -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";
}