mirror of
https://github.com/ansible/awx.git
synced 2026-03-09 21:49:27 -02:30
Merge pull request #296 from jaredevantabor/host-event-modal
Fixing host-event's stdout/stdout ng-if logic
This commit is contained in:
@@ -3,10 +3,6 @@
|
|||||||
<div class="HostEvent-numberColumnPreload"></div>
|
<div class="HostEvent-numberColumnPreload"></div>
|
||||||
<div class="HostEvent-numberColumn">1</div>
|
<div class="HostEvent-numberColumn">1</div>
|
||||||
<div class="HostEvent-stdoutColumn" ng-bind-html="stderr"></div>
|
<div class="HostEvent-stdoutColumn" ng-bind-html="stderr"></div>
|
||||||
<div class="HostEvent-numberColumn HostEvent-numberColumn--second">
|
|
||||||
2
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
<div class="HostEvent-stdout">
|
<div id="HostEvent-stdout" class="HostEvent-stdout">
|
||||||
<div class="HostEvent-stdoutContainer">
|
<div class="HostEvent-stdoutContainer">
|
||||||
<div class="HostEvent-numberColumnPreload"></div>
|
<div class="HostEvent-numberColumnPreload"></div>
|
||||||
<div class="HostEvent-numberColumn">1</div>
|
<div class="HostEvent-numberColumn">1</div>
|
||||||
<div class="HostEvent-stdoutColumn" ng-bind-html="stdout"></div>
|
<div class="HostEvent-stdoutColumn" ng-bind-html="stdout"></div>
|
||||||
<div class="HostEvent-numberColumn HostEvent-numberColumn--second">
|
|
||||||
2
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -24,10 +24,6 @@
|
|||||||
});
|
});
|
||||||
editor.setSize("100%", 200);
|
editor.setSize("100%", 200);
|
||||||
editor.getDoc().setValue(data);
|
editor.getDoc().setValue(data);
|
||||||
$('.modal-dialog').on('resize', function(){
|
|
||||||
let height = $('.modal-dialog').height() - $('.HostEvent-header').height() - $('.HostEvent-details').height() - $('.HostEvent-nav').height() - $('.HostEvent-controls').height() - 120;
|
|
||||||
editor.setSize("100%", height);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
/*ignore jslint end*/
|
/*ignore jslint end*/
|
||||||
$scope.isActiveState = function(name){
|
$scope.isActiveState = function(name){
|
||||||
@@ -53,11 +49,15 @@
|
|||||||
$scope.event = _.cloneDeep(hostEvent);
|
$scope.event = _.cloneDeep(hostEvent);
|
||||||
|
|
||||||
// grab standard out & standard error if present from the host
|
// grab standard out & standard error if present from the host
|
||||||
// event's "res" object, for things like Ansible modules
|
// event's "res" object, for things like Ansible modules. Small
|
||||||
|
// wrinkle in this implementation is that the stdout/stderr tabs
|
||||||
|
// should be shown if the `res` object has stdout/stderr keys, even
|
||||||
|
// if they're a blank string. The presence of these keys is
|
||||||
|
// potentially significant to a user.
|
||||||
try{
|
try{
|
||||||
$scope.module_name = hostEvent.event_data.task_action || "No result found";
|
$scope.module_name = hostEvent.event_data.task_action || "No result found";
|
||||||
$scope.stdout = (hostEvent.event_data.res.stdout === "" || " ") ? undefined : hostEvent.event_data.res.stdout;
|
$scope.stdout = hostEvent.event_data.res.stdout ? hostEvent.event_data.res.stdout : hostEvent.event_data.res.stdout === "" ? " " : undefined;
|
||||||
$scope.stderr = (hostEvent.event_data.res.stderr === "" || " ") ? undefined : hostEvent.event_data.res.stderr;
|
$scope.stderr = hostEvent.event_data.res.stderr ? hostEvent.event_data.res.stderr : hostEvent.event_data.res.stderr === "" ? " " : undefined;
|
||||||
$scope.json = hostEvent.event_data.res;
|
$scope.json = hostEvent.event_data.res;
|
||||||
}
|
}
|
||||||
catch(err){
|
catch(err){
|
||||||
@@ -78,6 +78,7 @@
|
|||||||
try{
|
try{
|
||||||
if(_.has(hostEvent.event_data, "res")){
|
if(_.has(hostEvent.event_data, "res")){
|
||||||
initCodeMirror('HostEvent-codemirror', JSON.stringify($scope.json, null, 4), {name: "javascript", json: true});
|
initCodeMirror('HostEvent-codemirror', JSON.stringify($scope.json, null, 4), {name: "javascript", json: true});
|
||||||
|
resize();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$scope.no_json = true;
|
$scope.no_json = true;
|
||||||
@@ -90,7 +91,7 @@
|
|||||||
}
|
}
|
||||||
else if ($state.current.name === 'jobResult.host-event.stdout'){
|
else if ($state.current.name === 'jobResult.host-event.stdout'){
|
||||||
try{
|
try{
|
||||||
initCodeMirror('HostEvent-codemirror', $scope.stdout, 'shell');
|
resize();
|
||||||
}
|
}
|
||||||
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
|
||||||
@@ -98,7 +99,7 @@
|
|||||||
}
|
}
|
||||||
else if ($state.current.name === 'jobResult.host-event.stderr'){
|
else if ($state.current.name === 'jobResult.host-event.stderr'){
|
||||||
try{
|
try{
|
||||||
initCodeMirror('HostEvent-codemirror', $scope.stderr, 'shell');
|
resize();
|
||||||
}
|
}
|
||||||
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
|
||||||
@@ -113,6 +114,26 @@
|
|||||||
cancel: '.CodeMirror'
|
cancel: '.CodeMirror'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function resize(){
|
||||||
|
if ($state.current.name === 'jobResult.host-event.json'){
|
||||||
|
let editor = $('.CodeMirror')[0].CodeMirror;
|
||||||
|
let height = $('.modal-dialog').height() - $('.HostEvent-header').height() - $('.HostEvent-details').height() - $('.HostEvent-nav').height() - $('.HostEvent-controls').height() - 120;
|
||||||
|
editor.setSize("100%", height);
|
||||||
|
}
|
||||||
|
else if($state.current.name === 'jobResult.host-event.stdout' || $state.current.name === 'jobResult.host-event.stderr'){
|
||||||
|
let height = $('.modal-dialog').height() - $('.HostEvent-header').height() - $('.HostEvent-details').height() - $('.HostEvent-nav').height() - $('.HostEvent-controls').height() - 120;
|
||||||
|
$(".HostEvent-stdout").width("100%");
|
||||||
|
$(".HostEvent-stdout").height(height);
|
||||||
|
$(".HostEvent-stdoutContainer").height(height);
|
||||||
|
$(".HostEvent-numberColumnPreload").height(height);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$('.modal-dialog').on('resize', function(){
|
||||||
|
resize();
|
||||||
|
});
|
||||||
|
|
||||||
$('#HostEvent').on('hidden.bs.modal', function () {
|
$('#HostEvent').on('hidden.bs.modal', function () {
|
||||||
$scope.closeHostEvent();
|
$scope.closeHostEvent();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user