fixed SSH reconnection behaviour - fixed #3446, fixed #3442

This commit is contained in:
Eugene Pankov 2021-02-13 12:42:15 +01:00
parent 9734830a74
commit a8c7134218
No known key found for this signature in database
GPG key ID: 5896FCBBDD1CF4F4
4 changed files with 23 additions and 19 deletions

View file

@ -1,10 +1,10 @@
.tab-toolbar
.tab-toolbar([class.show]='!session || !session.open')
.btn.btn-outline-secondary.reveal-button
i.fas.fa-ellipsis-h
.toolbar([class.show]='!session || !session.open')
.toolbar
i.fas.fa-circle.text-success.mr-2(*ngIf='session && session.open')
i.fas.fa-circle.text-danger.mr-2(*ngIf='!session || !session.open')
strong(*ngIf='session') {{session.connection.port}} ({{session.connection.baudrate}})
strong {{connection.port}} ({{connection.baudrate}})
.mr-auto

View file

@ -97,11 +97,13 @@ export class SerialTabComponent extends BaseTerminalTabComponent {
}))
this.attachSessionHandler(this.session!.destroyed$.subscribe(() => {
this.write('Press any key to reconnect\r\n')
this.input$.pipe(first()).subscribe(() => {
if (!this.session?.open) {
this.reconnect()
}
})
setTimeout(() => {
this.input$.pipe(first()).subscribe(() => {
if (!this.session?.open) {
this.reconnect()
}
})
}, 100)
}))
super.attachSessionHandlers()
}

View file

@ -1,14 +1,14 @@
.tab-toolbar
.tab-toolbar([class.show]='!session || !session.open')
.btn.btn-outline-secondary.reveal-button
i.fas.fa-ellipsis-h
.toolbar(*ngIf='session', [class.show]='!session.open')
i.fas.fa-circle.text-success.mr-2(*ngIf='session.open')
i.fas.fa-circle.text-danger.mr-2(*ngIf='!session.open')
strong.mr-auto(*ngIf='session') {{session.connection.user}}@{{session.connection.host}}:{{session.connection.port}}
.toolbar
i.fas.fa-circle.text-success.mr-2(*ngIf='session && session.open')
i.fas.fa-circle.text-danger.mr-2(*ngIf='!session || !session.open')
strong.mr-auto {{connection.user}}@{{connection.host}}:{{connection.port}}
button.btn.btn-secondary.mr-2((click)='reconnect()', [class.btn-info]='!session.open')
button.btn.btn-secondary.mr-2((click)='reconnect()', [class.btn-info]='!session || !session.open')
span Reconnect
button.btn.btn-secondary((click)='showPortForwarding()', *ngIf='session.open')
button.btn.btn-secondary((click)='showPortForwarding()', *ngIf='session && session.open')
i.fas.fa-plug
span Ports

View file

@ -143,7 +143,6 @@ export class SSHTabComponent extends BaseTerminalTabComponent {
protected attachSessionHandlers (): void {
const session = this.session!
super.attachSessionHandlers()
this.attachSessionHandler(session.destroyed$.subscribe(() => {
if (
// Ctrl-D
@ -158,12 +157,15 @@ export class SSHTabComponent extends BaseTerminalTabComponent {
if (!this.reconnectOffered) {
this.reconnectOffered = true
this.write('Press any key to reconnect\r\n')
this.attachSessionHandler(this.input$.pipe(first()).subscribe(() => {
this.reconnect()
}))
setTimeout(() => {
this.attachSessionHandler(this.input$.pipe(first()).subscribe(() => {
this.reconnect()
}))
}, 100)
}
}
}))
super.attachSessionHandlers()
}
async initializeSession (): Promise<void> {