mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 10:00:01 -03:30
Merge pull request #4950 from jaredevantabor/job-explanation
Fix for job results explanation and traceback
This commit is contained in:
commit
c01936d714
@ -1,5 +1,5 @@
|
||||
export default ['jobData', 'jobDataOptions', 'jobLabels', 'jobFinished', 'count', '$scope', 'ParseTypeChange', 'ParseVariableString', 'jobResultsService', 'eventQueue', '$compile', '$log', 'Dataset', '$q', 'Rest', '$state', 'QuerySet', '$rootScope', 'moment', '$stateParams', 'i18n',
|
||||
function(jobData, jobDataOptions, jobLabels, jobFinished, count, $scope, ParseTypeChange, ParseVariableString, jobResultsService, eventQueue, $compile, $log, Dataset, $q, Rest, $state, QuerySet, $rootScope, moment, $stateParams, i18n) {
|
||||
export default ['jobData', 'jobDataOptions', 'jobLabels', 'jobFinished', 'count', '$scope', 'ParseTypeChange', 'ParseVariableString', 'jobResultsService', 'eventQueue', '$compile', '$log', 'Dataset', '$q', 'Rest', '$state', 'QuerySet', '$rootScope', 'moment', '$stateParams', 'i18n', 'fieldChoices', 'fieldLabels',
|
||||
function(jobData, jobDataOptions, jobLabels, jobFinished, count, $scope, ParseTypeChange, ParseVariableString, jobResultsService, eventQueue, $compile, $log, Dataset, $q, Rest, $state, QuerySet, $rootScope, moment, $stateParams, i18n, fieldChoices, fieldLabels) {
|
||||
var toDestroy = [];
|
||||
var cancelRequests = false;
|
||||
|
||||
@ -106,6 +106,38 @@ function(jobData, jobDataOptions, jobLabels, jobFinished, count, $scope, ParseTy
|
||||
}
|
||||
}));
|
||||
|
||||
$scope.previousTaskFailed = false;
|
||||
|
||||
toDestroy.push($scope.$watch('job.job_explanation', function(explanation) {
|
||||
if (explanation && explanation.split(":")[0] === "Previous Task Failed") {
|
||||
$scope.previousTaskFailed = true;
|
||||
|
||||
var taskObj = JSON.parse(explanation.substring(explanation.split(":")[0].length + 1));
|
||||
// return a promise from the options request with the permission type choices (including adhoc) as a param
|
||||
var fieldChoice = fieldChoices({
|
||||
$scope: $scope,
|
||||
url: 'api/v1/unified_jobs/',
|
||||
field: 'type'
|
||||
});
|
||||
|
||||
// manipulate the choices from the options request to be set on
|
||||
// scope and be usable by the list form
|
||||
fieldChoice.then(function (choices) {
|
||||
choices =
|
||||
fieldLabels({
|
||||
choices: choices
|
||||
});
|
||||
$scope.explanation_fail_type = choices[taskObj.job_type];
|
||||
$scope.explanation_fail_name = taskObj.job_name;
|
||||
$scope.explanation_fail_id = taskObj.job_id;
|
||||
$scope.task_detail = $scope.explanation_fail_type + " failed for " + $scope.explanation_fail_name + " with ID " + $scope.explanation_fail_id + ".";
|
||||
});
|
||||
} else {
|
||||
$scope.previousTaskFailed = false;
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
// update the job_status value. Use the cached rootScope value if there
|
||||
// is one. This is a workaround when the rest call for the jobData is
|
||||
// made before some socket events come in for the job status
|
||||
@ -141,6 +173,7 @@ function(jobData, jobDataOptions, jobLabels, jobFinished, count, $scope, ParseTy
|
||||
if(jobData.result_traceback) {
|
||||
$scope.job.result_traceback = jobData.result_traceback.trim().split('\n').join('<br />');
|
||||
}
|
||||
|
||||
// use options labels to manipulate display of details
|
||||
getTowerLabels();
|
||||
|
||||
|
||||
@ -104,14 +104,30 @@
|
||||
<label class="JobResults-resultRowLabel">
|
||||
Explanation
|
||||
</label>
|
||||
<div class="JobResults-resultRowText">
|
||||
{{job.job_explanation}}
|
||||
<div class="JobResults-resultRowText"
|
||||
ng-show="!previousTaskFailed">
|
||||
{{job.job_explanation}}
|
||||
</div>
|
||||
<div class="JobDetail-resultRowText "
|
||||
ng-show="previousTaskFailed">Previous Task Failed
|
||||
<a
|
||||
href=""
|
||||
id="explanation_help"
|
||||
aw-pop-over="{{ task_detail }}"
|
||||
aw-pop-over-watch="task_detail"
|
||||
data-placement="bottom"
|
||||
data-container="body" class="help-link" over-title="Failure Detail"
|
||||
title=""
|
||||
tabindex="-1">
|
||||
<i class="fa fa-question-circle">
|
||||
</i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- RESULTS TRACEBACK DETAIL -->
|
||||
<div class="JobResults-resultRow"
|
||||
ng-show="job.result_traceback">
|
||||
ng-show="job.result_traceback && !previousTaskFailed">
|
||||
<label class="JobResults-resultRowLabel">
|
||||
Results Traceback
|
||||
</label>
|
||||
|
||||
@ -4,7 +4,7 @@ describe('Controller: jobResultsController', () => {
|
||||
// Setup
|
||||
let jobResultsController;
|
||||
|
||||
let jobData, jobDataOptions, jobLabels, jobFinished, count, $scope, ParseTypeChange, ParseVariableString, jobResultsService, eventQueue, $compile, eventResolve, populateResolve, $rScope, q, $log, Dataset, Rest, $state, QuerySet, i18n;
|
||||
let jobData, jobDataOptions, jobLabels, jobFinished, count, $scope, ParseTypeChange, ParseVariableString, jobResultsService, eventQueue, $compile, eventResolve, populateResolve, $rScope, q, $log, Dataset, Rest, $state, QuerySet, i18n,fieldChoices, fieldLabels;
|
||||
|
||||
jobData = {
|
||||
related: {}
|
||||
@ -78,6 +78,8 @@ describe('Controller: jobResultsController', () => {
|
||||
$provide.value('$state', $state);
|
||||
$provide.value('QuerySet', QuerySet);
|
||||
$provide.value('i18n', i18n);
|
||||
$provide.value('fieldChoices', fieldChoices);
|
||||
$provide.value('fieldLabels', fieldLabels);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user