mirror of
https://github.com/ansible/awx.git
synced 2026-04-06 18:49:21 -02:30
adding error message if no json was returned for host event
aka if event_data.res is undefined
This commit is contained in:
@@ -1,2 +1,3 @@
|
|||||||
<textarea id="HostEvent-codemirror" class="HostEvent-codemirror">
|
<textarea ng-hide="no_json" id="HostEvent-codemirror" class="HostEvent-codemirror">
|
||||||
</textarea>
|
</textarea>
|
||||||
|
<div ng-if="no_json" class="HostEvent-noJson" translate>This module did not return any JSON</div>
|
||||||
|
|||||||
@@ -174,3 +174,16 @@
|
|||||||
margin-left: 46px;
|
margin-left: 46px;
|
||||||
padding-top: 4px;
|
padding-top: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.HostEvent-noJson{
|
||||||
|
align-items: center;
|
||||||
|
background-color: @default-no-items-bord;
|
||||||
|
border: 1px solid @default-icon-hov;
|
||||||
|
border-radius: 5px;
|
||||||
|
color: @b7grey;
|
||||||
|
display: flex;
|
||||||
|
height: 200px;
|
||||||
|
justify-content: center;
|
||||||
|
text-transform: uppercase;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|||||||
@@ -64,12 +64,11 @@
|
|||||||
// do nothing, no stdout/stderr for this module
|
// do nothing, no stdout/stderr for this module
|
||||||
}
|
}
|
||||||
if($scope.module_name === "debug" &&
|
if($scope.module_name === "debug" &&
|
||||||
hostEvent.event_data.res.hasOwnProperty('result') &&
|
_.has(hostEvent.event_data, "res.result.stdout")){
|
||||||
hostEvent.event_data.res.result.hasOwnProperty('stdout')){
|
|
||||||
$scope.stdout = hostEvent.event_data.res.result.stdout;
|
$scope.stdout = hostEvent.event_data.res.result.stdout;
|
||||||
}
|
}
|
||||||
if($scope.module_name === "yum" &&
|
if($scope.module_name === "yum" &&
|
||||||
hostEvent.event_data.res.hasOwnProperty('results') &&
|
_.has(hostEvent.event_data, "res.results") &&
|
||||||
_.isArray(hostEvent.event_data.res.results)){
|
_.isArray(hostEvent.event_data.res.results)){
|
||||||
$scope.stdout = hostEvent.event_data.res.results[0];
|
$scope.stdout = hostEvent.event_data.res.results[0];
|
||||||
}
|
}
|
||||||
@@ -77,7 +76,13 @@
|
|||||||
// 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
|
||||||
if ($state.current.name === 'jobResult.host-event.json'){
|
if ($state.current.name === 'jobResult.host-event.json'){
|
||||||
try{
|
try{
|
||||||
initCodeMirror('HostEvent-codemirror', JSON.stringify($scope.json, null, 4), {name: "javascript", json: true});
|
if(_.has(hostEvent.event_data, "res")){
|
||||||
|
initCodeMirror('HostEvent-codemirror', JSON.stringify($scope.json, null, 4), {name: "javascript", json: true});
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$scope.no_json = true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch(err){
|
catch(err){
|
||||||
// element with id HostEvent-codemirror is not the view controlled by this instance of HostEventController
|
// element with id HostEvent-codemirror is not the view controlled by this instance of HostEventController
|
||||||
@@ -101,7 +106,7 @@
|
|||||||
}
|
}
|
||||||
$('#HostEvent').modal('show');
|
$('#HostEvent').modal('show');
|
||||||
$('.modal-content').resizable({
|
$('.modal-content').resizable({
|
||||||
minHeight: 450,
|
minHeight: 523,
|
||||||
minWidth: 600
|
minWidth: 600
|
||||||
});
|
});
|
||||||
$('.modal-dialog').draggable({
|
$('.modal-dialog').draggable({
|
||||||
|
|||||||
Reference in New Issue
Block a user