Merge pull request #5516 from jaredevantabor/host-event-stdout

Fixing host event stdout/stderr
This commit is contained in:
Jared Tabor 2017-02-23 07:12:19 -08:00 committed by GitHub
commit fca5e1975a
5 changed files with 30 additions and 17 deletions

View File

@ -36,6 +36,11 @@
<div class="HostEvent-nav">
<!-- view navigation buttons -->
<button ui-sref="jobDetail.host-event.json" type="button"
class="btn btn-sm btn-default HostEvent-tab"
ng-class="{'HostEvent-tab--selected' : isActiveState('jobDetail.host-event.json')}">
JSON
</button>
<button ng-if="stdout" ui-sref="jobDetail.host-event.stdout"
type="button" class="btn btn-sm btn-default HostEvent-tab"
ng-class="{'HostEvent-tab--selected' : isActiveState('jobDetail.host-event.stdout')}">
@ -46,11 +51,7 @@
ng-class="{'HostEvent-tab--selected' : isActiveState('jobDetail.host-event.stderr')}">
Standard Error
</button>
<button ui-sref="jobDetail.host-event.json" type="button"
class="btn btn-sm btn-default HostEvent-tab"
ng-class="{'HostEvent-tab--selected' : isActiveState('jobDetail.host-event.json')}">
JSON
</button>
</div>
<div class="HostEvent-body">
<!-- views -->

View File

@ -0,0 +1,12 @@
<div class="HostEvent-stdout">
<div class="HostEvent-stdoutContainer">
<div class="HostEvent-numberColumnPreload"></div>
<div class="HostEvent-numberColumn">1</div>
<div class="HostEvent-stdoutColumn" ng-bind-html="stderr"></div>
<div class="HostEvent-numberColumn HostEvent-numberColumn--second">
2
</div>
</div>
</div>
</div>

View File

@ -6,8 +6,8 @@
export default
['$stateParams', '$scope', '$state', 'Wait', 'JobDetailService', 'hostEvent', 'hostResults', 'parseStdoutService',
function($stateParams, $scope, $state, Wait, JobDetailService, hostEvent, hostResults, parseStdoutService){
['$stateParams', '$scope', '$state', 'Wait', 'JobDetailService', 'hostEvent', 'hostResults',
function($stateParams, $scope, $state, Wait, JobDetailService, hostEvent, hostResults){
$scope.processEventStatus = JobDetailService.processEventStatus;
$scope.hostResults = [];
@ -18,7 +18,7 @@
else {return true;}
};
$scope.isStdOut = function(){
if ($state.current.name === 'jobDetails.host-event.stdout' || $state.current.name === 'jobDetaisl.histe-event.stderr'){
if ($state.current.name === 'jobDetail.host-event.stdout' || $state.current.name === 'jobDetail.host-event.stderr'){
return 'StandardOut-preContainer StandardOut-preContent';
}
};
@ -50,14 +50,14 @@
$scope.hostResults = hostResults;
$scope.json = JobDetailService.processJson(hostEvent);
// grab standard out & standard error if present, and remove from the results displayed in the details panel
if (hostEvent.stdout){
$scope.stdout = parseStdoutService.prettify(hostEvent.stdout);
delete $scope.event.stdout;
// grab standard out & standard error if present from the host
// event's "res" object, for things like Ansible modules
try{
$scope.stdout = hostEvent.event_data.res.stdout;
$scope.stderr = hostEvent.event_data.res.stderr;
}
if (hostEvent.stderr){
$scope.stderr = hostEvent.stderr;
delete $scope.event.stderr;
catch(err){
// do nothing, no stdout/stderr for this module
}
// instantiate Codemirror
// try/catch pattern prevents the abstract-state controller from complaining about element being null

View File

@ -51,7 +51,7 @@ var hostEventStderr = {
name: 'jobDetail.host-event.stderr',
url: '/stderr',
controller: 'HostEventController',
templateUrl: templateUrl('job-results/host-event/host-event-stdout')
templateUrl: templateUrl('job-results/host-event/host-event-stderr')
};

View File

@ -77,7 +77,7 @@ export default ['$log', 'moment', function($log, moment){
return `"`;
}
else{
return ` JobResultsStdOut-stdoutColumn--clickable" ui-sref="jobDetail.host-event.stdout({eventId: ${event.id}, taskUuid: '${event.event_data.task_uuid}' })" aw-tool-tip="Event ID: ${event.id} <br>Status: ${event.event_display} <br>Click for details" data-placement="top"`;
return ` JobResultsStdOut-stdoutColumn--clickable" ui-sref="jobDetail.host-event.json({eventId: ${event.id}, taskUuid: '${event.event_data.task_uuid}' })" aw-tool-tip="Event ID: ${event.id} <br>Status: ${event.event_display} <br>Click for details" data-placement="top"`;
}
},