mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 19:10:07 -03:30
adding error message if no json was returned for host event
aka if event_data.res is undefined
This commit is contained in:
parent
6cd8fbdf6d
commit
a40f81c327
@ -1,2 +1,3 @@
|
||||
<textarea id="HostEvent-codemirror" class="HostEvent-codemirror">
|
||||
<textarea ng-hide="no_json" id="HostEvent-codemirror" class="HostEvent-codemirror">
|
||||
</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;
|
||||
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
|
||||
}
|
||||
if($scope.module_name === "debug" &&
|
||||
hostEvent.event_data.res.hasOwnProperty('result') &&
|
||||
hostEvent.event_data.res.result.hasOwnProperty('stdout')){
|
||||
_.has(hostEvent.event_data, "res.result.stdout")){
|
||||
$scope.stdout = hostEvent.event_data.res.result.stdout;
|
||||
}
|
||||
if($scope.module_name === "yum" &&
|
||||
hostEvent.event_data.res.hasOwnProperty('results') &&
|
||||
_.has(hostEvent.event_data, "res.results") &&
|
||||
_.isArray(hostEvent.event_data.res.results)){
|
||||
$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
|
||||
if ($state.current.name === 'jobResult.host-event.json'){
|
||||
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){
|
||||
// element with id HostEvent-codemirror is not the view controlled by this instance of HostEventController
|
||||
@ -101,7 +106,7 @@
|
||||
}
|
||||
$('#HostEvent').modal('show');
|
||||
$('.modal-content').resizable({
|
||||
minHeight: 450,
|
||||
minHeight: 523,
|
||||
minWidth: 600
|
||||
});
|
||||
$('.modal-dialog').draggable({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user