mirror of
https://github.com/bingohuang/docker-labs.git
synced 2025-07-14 01:57:32 +08:00
Focus terminal when switching instances
This commit is contained in:
parent
1d550aaa46
commit
991594c35c
@ -62,9 +62,11 @@
|
||||
$scope.showInstance = function(instance) {
|
||||
$scope.selectedInstance = instance;
|
||||
if (!instance.isAttached) {
|
||||
$timeout(function() {createTerminal(instance.name)});
|
||||
$timeout(function() {instance.term = createTerminal(instance.name);});
|
||||
instance.isAttached = true;
|
||||
}
|
||||
} else {
|
||||
$timeout(function() {instance.term.focus()});
|
||||
}
|
||||
}
|
||||
|
||||
$scope.deleteInstance = function(instance) {
|
||||
|
@ -37,7 +37,7 @@ function createTerminal(name) {
|
||||
while (terminalContainer.children.length) {
|
||||
terminalContainer.removeChild(terminalContainer.children[0]);
|
||||
}
|
||||
term = new Terminal({
|
||||
var term = new Terminal({
|
||||
cursorBlink: false
|
||||
});
|
||||
var sessionId = location.pathname.substr(location.pathname.lastIndexOf("/")+1);
|
||||
@ -47,12 +47,14 @@ function createTerminal(name) {
|
||||
term.open(terminalContainer);
|
||||
|
||||
socket = new WebSocket(socketURL);
|
||||
socket.onopen = runRealTerminal;
|
||||
socket.onopen = runRealTerminal(term);
|
||||
|
||||
return term;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function runRealTerminal() {
|
||||
function runRealTerminal(term) {
|
||||
term.attach(socket);
|
||||
term._initialized = true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user