mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 11:20:39 -03:30
Merge pull request #284 from mabashian/7273-explanation
Fixed explanation for inv sync and playbook run stdout
This commit is contained in:
commit
07d9d4bca6
@ -232,3 +232,13 @@ job-results-standard-out {
|
||||
margin-left: 10px;
|
||||
color: @default-icon;
|
||||
}
|
||||
|
||||
.JobResults-seeMoreLess {
|
||||
color: #337AB7;
|
||||
margin: 4px 0px;
|
||||
text-transform: uppercase;
|
||||
padding: 2px 0px;
|
||||
cursor: pointer;
|
||||
border-radius: 5px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
@ -22,6 +22,8 @@ function(jobData, jobDataOptions, jobLabels, jobFinished, count, $scope, ParseTy
|
||||
var currentContext = 1;
|
||||
$scope.firstCounterFromSocket = -1;
|
||||
|
||||
$scope.explanationLimit = 150;
|
||||
|
||||
// if the user enters the page mid-run, reset the search to include a param
|
||||
// to only grab events less than the first counter from the websocket events
|
||||
toDestroy.push($scope.$watch('firstCounterFromSocket', function(counter) {
|
||||
|
||||
@ -75,6 +75,22 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- EXPLANATION DETAIL -->
|
||||
<div class="JobResults-resultRow"
|
||||
ng-show="job.job_explanation">
|
||||
<label class="JobResults-resultRowLabel" translate>
|
||||
Explanation
|
||||
</label>
|
||||
<div class="JobResults-resultRowText">
|
||||
{{task_detail | limitTo:explanationLimit}}
|
||||
<span ng-show="explanationLimit && task_detail.length > explanationLimit">
|
||||
<span>... </span>
|
||||
<span class="JobResults-seeMoreLess" ng-click="explanationLimit=undefined">Show More</span>
|
||||
</span>
|
||||
<span ng-show="explanationLimit === undefined" class="JobResults-seeMoreLess" ng-click="explanationLimit=150">Show Less</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- START TIME DETAIL -->
|
||||
<div class="JobResults-resultRow"
|
||||
ng-show="job.started">
|
||||
@ -98,33 +114,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- EXPLANATION DETAIL -->
|
||||
<div class="JobResults-resultRow"
|
||||
ng-show="job.job_explanation">
|
||||
<label class="JobResults-resultRowLabel" translate>
|
||||
Explanation
|
||||
</label>
|
||||
<div class="JobResults-resultRowText"
|
||||
ng-show="!previousTaskFailed">
|
||||
{{job.job_explanation}}
|
||||
</div>
|
||||
<div class="jobResult-resultRowText "
|
||||
ng-show="previousTaskFailed">{{ 'Previous Task Failed' | translate }}
|
||||
<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 && !previousTaskFailed">
|
||||
|
||||
@ -41,6 +41,19 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- EXPLANATION DETAIL -->
|
||||
<div class="StandardOut-detailsRow">
|
||||
<div class="StandardOut-detailsLabel col-lg-3 col-md-3 col-sm-3 col-xs-4" translate>EXPLANATION</div>
|
||||
<div class="StandardOut-detailsContent col-lg-9 col-md-9 col-sm-9 col-xs-8">
|
||||
{{task_detail | limitTo:explanationLimit}}
|
||||
<span ng-show="explanationLimit && task_detail.length > explanationLimit">
|
||||
<span>... </span>
|
||||
<span class="StandardOut-seeMoreLess" ng-click="explanationLimit=undefined">Show More</span>
|
||||
</span>
|
||||
<span ng-show="explanationLimit === undefined" class="StandardOut-seeMoreLess" ng-click="explanationLimit=150">Show Less</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="StandardOut-detailsRow" ng-show="{{job.license_error !== null}}">
|
||||
<div class="StandardOut-detailsLabel col-lg-3 col-md-3 col-sm-3 col-xs-4" translate>LICENSE ERROR</div>
|
||||
<div class="StandardOut-detailsContent StandardOut--capitalize">
|
||||
|
||||
@ -158,3 +158,13 @@ standard-out-log {
|
||||
.StandardOut-actionButton + a {
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
.StandardOut-seeMoreLess {
|
||||
color: #337AB7;
|
||||
margin: 4px 0px;
|
||||
text-transform: uppercase;
|
||||
padding: 2px 0px;
|
||||
cursor: pointer;
|
||||
border-radius: 5px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
@ -12,7 +12,8 @@
|
||||
|
||||
export function JobStdoutController ($rootScope, $scope, $state, $stateParams,
|
||||
GetBasePath, Rest, ProcessErrors, Empty, GetChoices, LookUpName,
|
||||
ParseTypeChange, ParseVariableString, RelaunchJob, DeleteJob, Wait, i18n) {
|
||||
ParseTypeChange, ParseVariableString, RelaunchJob, DeleteJob, Wait, i18n,
|
||||
fieldChoices, fieldLabels) {
|
||||
|
||||
var job_id = $stateParams.id,
|
||||
jobType = $state.current.data.jobType;
|
||||
@ -22,6 +23,8 @@ export function JobStdoutController ($rootScope, $scope, $state, $stateParams,
|
||||
$scope.stdoutFullScreen = false;
|
||||
$scope.toggleStdoutFullscreenTooltip = i18n._("Expand Output");
|
||||
|
||||
$scope.explanationLimit = 150;
|
||||
|
||||
// Listen for job status updates that may come across via sockets. We need to check the payload
|
||||
// to see whethere the updated job is the one that we're currently looking at.
|
||||
$scope.$on(`ws-jobs`, function(e, data) {
|
||||
@ -35,6 +38,37 @@ export function JobStdoutController ($rootScope, $scope, $state, $stateParams,
|
||||
}
|
||||
});
|
||||
|
||||
$scope.previousTaskFailed = false;
|
||||
|
||||
$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: GetBasePath('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;
|
||||
}
|
||||
});
|
||||
|
||||
// Set the parse type so that CodeMirror knows how to display extra params YAML/JSON
|
||||
$scope.parseType = 'yaml';
|
||||
|
||||
@ -242,4 +276,5 @@ export function JobStdoutController ($rootScope, $scope, $state, $stateParams,
|
||||
JobStdoutController.$inject = [ '$rootScope', '$scope', '$state',
|
||||
'$stateParams', 'GetBasePath', 'Rest', 'ProcessErrors',
|
||||
'Empty', 'GetChoices', 'LookUpName', 'ParseTypeChange',
|
||||
'ParseVariableString', 'RelaunchJob', 'DeleteJob', 'Wait', 'i18n'];
|
||||
'ParseVariableString', 'RelaunchJob', 'DeleteJob', 'Wait', 'i18n',
|
||||
'fieldChoices', 'fieldLabels'];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user