Fix terminal resize on window resize
This still does not update the terminal COLUMNS and ROWS
This commit is contained in:
@@ -244,8 +244,9 @@ app.controller('TerminalController', ['$scope', '$timeout', '$location', 'Client
|
||||
$scope.schedulerTasks = result.manifest.addons.scheduler ? Object.keys(result.manifest.addons.scheduler).map(function (k) { return { name: k, command: result.manifest.addons.scheduler[k].command }; }) : [];
|
||||
|
||||
$scope.terminal = new Terminal();
|
||||
$scope.terminal.open(document.querySelector('#terminalContainer'));
|
||||
$scope.terminal.fit();
|
||||
$scope.terminal.open(document.querySelector('#terminalContainer'), true);
|
||||
|
||||
window.terminal = $scope.terminal;
|
||||
|
||||
try {
|
||||
// websocket cannot use relative urls
|
||||
@@ -270,6 +271,9 @@ app.controller('TerminalController', ['$scope', '$timeout', '$location', 'Client
|
||||
|
||||
if (retry) $scope.terminal.writeln('Reconnecting...');
|
||||
else $scope.terminal.writeln('Connecting...');
|
||||
|
||||
// we have to give it some time to setup the terminal to make it fit, there is no event unfortunately
|
||||
setTimeout(function () { if ($scope.terminal) $scope.terminal.fit(); }, 1000);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -353,6 +357,10 @@ app.controller('TerminalController', ['$scope', '$timeout', '$location', 'Client
|
||||
return false;
|
||||
});
|
||||
|
||||
window.addEventListener('resize', function (e) {
|
||||
if ($scope.terminal) $scope.terminal.fit();
|
||||
});
|
||||
|
||||
Client.getStatus(function (error, status) {
|
||||
if (error) return $scope.error(error);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user