mirror of
https://github.com/ansible/awx.git
synced 2026-02-27 07:56:06 -03:30
Fix for job reults explanation and traceback for SCM update failures
This commit is contained in:
@@ -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',
|
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) {
|
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 toDestroy = [];
|
||||||
var cancelRequests = false;
|
var cancelRequests = false;
|
||||||
|
|
||||||
@@ -106,6 +106,42 @@ function(jobData, jobDataOptions, jobLabels, jobFinished, count, $scope, ParseTy
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
$scope.previousTaskFailed = false;
|
||||||
|
$scope.hideTraceback = false;
|
||||||
|
|
||||||
|
toDestroy.push($scope.$watch('job.job_explanation', function(explanation) {
|
||||||
|
if (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 + ".";
|
||||||
|
});
|
||||||
|
|
||||||
|
if(taskObj.job_type === "project_update"){
|
||||||
|
$scope.hideTraceback = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$scope.previousTaskFailed = false;
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
// update the job_status value. Use the cached rootScope value if there
|
// 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
|
// 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
|
// made before some socket events come in for the job status
|
||||||
@@ -141,6 +177,7 @@ function(jobData, jobDataOptions, jobLabels, jobFinished, count, $scope, ParseTy
|
|||||||
if(jobData.result_traceback) {
|
if(jobData.result_traceback) {
|
||||||
$scope.job.result_traceback = jobData.result_traceback.trim().split('\n').join('<br />');
|
$scope.job.result_traceback = jobData.result_traceback.trim().split('\n').join('<br />');
|
||||||
}
|
}
|
||||||
|
|
||||||
// use options labels to manipulate display of details
|
// use options labels to manipulate display of details
|
||||||
getTowerLabels();
|
getTowerLabels();
|
||||||
|
|
||||||
|
|||||||
@@ -104,14 +104,30 @@
|
|||||||
<label class="JobResults-resultRowLabel">
|
<label class="JobResults-resultRowLabel">
|
||||||
Explanation
|
Explanation
|
||||||
</label>
|
</label>
|
||||||
<div class="JobResults-resultRowText">
|
<div class="JobResults-resultRowText"
|
||||||
{{job.job_explanation}}
|
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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- RESULTS TRACEBACK DETAIL -->
|
<!-- RESULTS TRACEBACK DETAIL -->
|
||||||
<div class="JobResults-resultRow"
|
<div class="JobResults-resultRow"
|
||||||
ng-show="job.result_traceback">
|
ng-show="job.result_traceback && !hideTraceback">
|
||||||
<label class="JobResults-resultRowLabel">
|
<label class="JobResults-resultRowLabel">
|
||||||
Results Traceback
|
Results Traceback
|
||||||
</label>
|
</label>
|
||||||
|
|||||||
Reference in New Issue
Block a user