Reconnect the terminal on disconnection

This can happen if the app crashes or restarts
This commit is contained in:
Johannes Zellner
2017-08-15 21:51:12 +02:00
committed by Girish Ramakrishnan
parent 50074b936a
commit 2420fef6b1

View File

@@ -93,8 +93,13 @@ angular.module('Application').controller('LogsController', ['$scope', '$location
var url = Client.apiOrigin.replace('https', 'wss') + '/api/v1/apps/' + $scope.selected.value + '/exec?tty=true';
var socket = new WebSocket(url);
$scope.terminal.attach(socket);
socket.onclose = function () {
// retry in one second
setTimeout($scope.showTerminal, 1000);
};
} catch (e) {
console.error('-----', e);
console.error(e);
}
$scope.terminal.open(document.querySelector('.logs-and-term-container'));