Resize terminal based on initial DOM size

Currently we cannot send new cols,rows on DOM element resize
as they are sent on connect only and a reconnect would loose
current session
This commit is contained in:
Johannes Zellner
2017-08-19 11:30:32 +02:00
parent 52832c881a
commit cf518b0285

View File

@@ -132,10 +132,12 @@ angular.module('Application').controller('DebugController', ['$scope', '$locatio
}
$scope.terminal = new Terminal();
$scope.terminal.open(document.querySelector('.logs-and-term-container'));
$scope.terminal.fit();
try {
// websocket cannot use relative urls
var url = Client.apiOrigin.replace('https', 'wss') + '/api/v1/apps/' + $scope.selected.value + '/execws?tty=true&access_token=' + Client.getToken();
var url = Client.apiOrigin.replace('https', 'wss') + '/api/v1/apps/' + $scope.selected.value + '/execws?tty=true&rows=' + $scope.terminal.rows + '&columns=' + $scope.terminal.cols + '&access_token=' + Client.getToken();
$scope.terminalSocket = new WebSocket(url);
$scope.terminal.attach($scope.terminalSocket);
@@ -147,9 +149,6 @@ angular.module('Application').controller('DebugController', ['$scope', '$locatio
console.error(e);
}
$scope.terminal.open(document.querySelector('.logs-and-term-container'));
$scope.terminal.fit();
if (retry) $scope.terminal.writeln('Reconnecting...');
else $scope.terminal.writeln('Connecting...');
};