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

Host event modal changes, hopefully for the last time
This commit is contained in:
Jared Tabor 2017-02-24 13:43:25 -08:00 committed by GitHub
commit 33ca5c6270
2 changed files with 12 additions and 2 deletions

View File

@ -18,6 +18,10 @@
<div class="HostEvent-field">
<span class="HostEvent-field--label">CREATED</span>
<span class="HostEvent-field--content">{{(event.created | longDate) || "No result found"}}</span>
</div>
<div class="HostEvent-field">
<span class="HostEvent-field--label">ID</span>
<span class="HostEvent-field--content">{{event.id || "No result found"}}</span>
</div>
<div class="HostEvent-field">
<span class="HostEvent-field--label">PLAY</span>
@ -29,7 +33,7 @@
</div>
<div class="HostEvent-field">
<span class="HostEvent-field--label">MODULE</span>
<span class="HostEvent-field--content">{{event.event_data.res.invocation.module_name || "No result found"}}</span>
<span class="HostEvent-field--content">{{module_name}}</span>
</div>
</div>

View File

@ -48,17 +48,23 @@
hostEvent.event_name = hostEvent.event;
$scope.event = _.cloneDeep(hostEvent);
$scope.hostResults = hostResults;
$scope.json = JobDetailService.processJson(hostEvent);
// grab standard out & standard error if present from the host
// event's "res" object, for things like Ansible modules
try{
$scope.module_name = hostEvent.event_data.res.invocation.module_name || hostEvent.event_data.res.task_action || "No result found";
$scope.stdout = hostEvent.event_data.res.stdout;
$scope.stderr = hostEvent.event_data.res.stderr;
$scope.json = hostEvent.event_data.res;
}
catch(err){
// do nothing, no stdout/stderr for this module
}
if($scope.module_name === "yum" &&
hostEvent.event_data.res.hasOwnProperty('results') &&
_.isArray(hostEvent.event_data.res.results)){
$scope.stdout = hostEvent.event_data.res.results[0];
}
// instantiate Codemirror
// try/catch pattern prevents the abstract-state controller from complaining about element being null
if ($state.current.name === 'jobDetail.host-event.json'){