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