diff --git a/src/js/terminal.js b/src/js/terminal.js index 45ffa9849..1cb3d77ea 100644 --- a/src/js/terminal.js +++ b/src/js/terminal.js @@ -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); diff --git a/src/terminal.html b/src/terminal.html index c07eede37..9dd50d919 100644 --- a/src/terminal.html +++ b/src/terminal.html @@ -49,7 +49,7 @@ -
+