mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 02:50:02 -03:30
Merge pull request #2443 from jakemcdermott/fix-2397
sanitize host detail modal stderr/stdout
This commit is contained in:
commit
630cdce244
@ -170,10 +170,13 @@
|
||||
}
|
||||
|
||||
.HostEvent-stdoutColumn{
|
||||
white-space: pre;
|
||||
overflow-y: scroll;
|
||||
overflow-y: hidden;
|
||||
overflow-x: auto;
|
||||
margin-left: 46px;
|
||||
padding-top: 4px;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.HostEvent-noJson{
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
function HostEventsController (
|
||||
$scope,
|
||||
$state,
|
||||
$filter,
|
||||
HostEventService,
|
||||
hostEvent,
|
||||
OutputStrings
|
||||
@ -11,6 +12,9 @@ function HostEventsController (
|
||||
$scope.getActiveHostIndex = getActiveHostIndex;
|
||||
$scope.closeHostEvent = closeHostEvent;
|
||||
$scope.strings = OutputStrings;
|
||||
|
||||
const sanitize = $filter('sanitize');
|
||||
|
||||
function init () {
|
||||
hostEvent.event_name = hostEvent.event;
|
||||
$scope.event = _.cloneDeep(hostEvent);
|
||||
@ -31,7 +35,7 @@ function HostEventsController (
|
||||
if (hostEvent.event_data.res.stdout === '') {
|
||||
$scope.stdout = ' ';
|
||||
} else {
|
||||
$scope.stdout = hostEvent.event_data.res.stdout;
|
||||
$scope.stdout = sanitize(hostEvent.event_data.res.stdout);
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,7 +43,7 @@ function HostEventsController (
|
||||
if (hostEvent.event_data.res.stderr === '') {
|
||||
$scope.stderr = ' ';
|
||||
} else {
|
||||
$scope.stderr = hostEvent.event_data.res.stderr;
|
||||
$scope.stderr = sanitize(hostEvent.event_data.res.stderr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,13 +53,13 @@ function HostEventsController (
|
||||
|
||||
if ($scope.module_name === 'debug' &&
|
||||
_.has(hostEvent.event_data, 'res.result.stdout')) {
|
||||
$scope.stdout = hostEvent.event_data.res.result.stdout;
|
||||
$scope.stdout = sanitize(hostEvent.event_data.res.result.stdout);
|
||||
}
|
||||
if ($scope.module_name === 'yum' &&
|
||||
_.has(hostEvent.event_data, 'res.results') &&
|
||||
_.isArray(hostEvent.event_data.res.results)) {
|
||||
const event = hostEvent.event_data.res.results;
|
||||
$scope.stdout = event[0];// eslint-disable-line prefer-destructuring
|
||||
$scope.stdout = sanitize(event[0]);// eslint-disable-line prefer-destructuring
|
||||
}
|
||||
// instantiate Codemirror
|
||||
if ($state.current.name === 'output.host-event.json') {
|
||||
@ -164,6 +168,7 @@ function HostEventsController (
|
||||
HostEventsController.$inject = [
|
||||
'$scope',
|
||||
'$state',
|
||||
'$filter',
|
||||
'HostEventService',
|
||||
'hostEvent',
|
||||
'OutputStrings'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user