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
5 changed files with 30 additions and 17 deletions

View File

@@ -36,6 +36,11 @@
<div class="HostEvent-nav"> <div class="HostEvent-nav">
<!-- view navigation buttons --> <!-- 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" <button ng-if="stdout" ui-sref="jobDetail.host-event.stdout"
type="button" class="btn btn-sm btn-default HostEvent-tab" type="button" class="btn btn-sm btn-default HostEvent-tab"
ng-class="{'HostEvent-tab--selected' : isActiveState('jobDetail.host-event.stdout')}"> ng-class="{'HostEvent-tab--selected' : isActiveState('jobDetail.host-event.stdout')}">
@@ -46,11 +51,7 @@
ng-class="{'HostEvent-tab--selected' : isActiveState('jobDetail.host-event.stderr')}"> ng-class="{'HostEvent-tab--selected' : isActiveState('jobDetail.host-event.stderr')}">
Standard Error Standard Error
</button> </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>
<div class="HostEvent-body"> <div class="HostEvent-body">
<!-- views --> <!-- 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 export default
['$stateParams', '$scope', '$state', 'Wait', 'JobDetailService', 'hostEvent', 'hostResults', 'parseStdoutService', ['$stateParams', '$scope', '$state', 'Wait', 'JobDetailService', 'hostEvent', 'hostResults',
function($stateParams, $scope, $state, Wait, JobDetailService, hostEvent, hostResults, parseStdoutService){ function($stateParams, $scope, $state, Wait, JobDetailService, hostEvent, hostResults){
$scope.processEventStatus = JobDetailService.processEventStatus; $scope.processEventStatus = JobDetailService.processEventStatus;
$scope.hostResults = []; $scope.hostResults = [];
@@ -18,7 +18,7 @@
else {return true;} else {return true;}
}; };
$scope.isStdOut = function(){ $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'; return 'StandardOut-preContainer StandardOut-preContent';
} }
}; };
@@ -50,14 +50,14 @@
$scope.hostResults = hostResults; $scope.hostResults = hostResults;
$scope.json = JobDetailService.processJson(hostEvent); $scope.json = JobDetailService.processJson(hostEvent);
// grab standard out & standard error if present, and remove from the results displayed in the details panel // grab standard out & standard error if present from the host
if (hostEvent.stdout){ // event's "res" object, for things like Ansible modules
$scope.stdout = parseStdoutService.prettify(hostEvent.stdout); try{
delete $scope.event.stdout; $scope.stdout = hostEvent.event_data.res.stdout;
$scope.stderr = hostEvent.event_data.res.stderr;
} }
if (hostEvent.stderr){ catch(err){
$scope.stderr = hostEvent.stderr; // do nothing, no stdout/stderr for this module
delete $scope.event.stderr;
} }
// instantiate Codemirror // instantiate Codemirror
// try/catch pattern prevents the abstract-state controller from complaining about element being null // 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', name: 'jobDetail.host-event.stderr',
url: '/stderr', url: '/stderr',
controller: 'HostEventController', 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 `"`; return `"`;
} }
else{ 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"`;
} }
}, },