ref: implement recentInputs on baseTerminalTab

This commit is contained in:
Clem 2023-04-22 15:23:59 +02:00
parent f423be1510
commit 6498c4f923
4 changed files with 21 additions and 17 deletions

View file

@ -47,10 +47,6 @@ export class SerialTabComponent extends BaseTerminalTabComponent<SerialProfile>
}
})
this.frontendReady$.pipe(first()).subscribe(() => {
this.initializeSession()
})
super.ngOnInit()
setImmediate(() => {
@ -58,6 +54,11 @@ export class SerialTabComponent extends BaseTerminalTabComponent<SerialProfile>
})
}
protected onFrontendReady (): void {
this.initializeSession()
super.onFrontendReady()
}
async initializeSession () {
const session = new SerialSession(this.injector, this.profile)
this.setSession(session)

View file

@ -30,7 +30,6 @@ export class SSHTabComponent extends BaseTerminalTabComponent<SSHProfile> implem
sftpPath = '/'
enableToolbar = true
activeKIPrompt: KeyboardInteractivePrompt|null = null
private recentInputs = ''
private reconnectOffered = false
constructor (
@ -71,17 +70,14 @@ export class SSHTabComponent extends BaseTerminalTabComponent<SSHProfile> implem
}
})
this.frontendReady$.pipe(first()).subscribe(() => {
this.initializeSession()
this.input$.subscribe(data => {
this.recentInputs += data
this.recentInputs = this.recentInputs.substring(this.recentInputs.length - 32)
})
})
super.ngOnInit()
}
protected onFrontendReady (): void {
this.initializeSession()
super.onFrontendReady()
}
async setupOneSession (injector: Injector, profile: SSHProfile, multiplex = true): Promise<SSHSession> {
let session = await this.sshMultiplexer.getSession(profile)
if (!multiplex || !session || !profile.options.reuseSession) {

View file

@ -36,13 +36,14 @@ export class TelnetTabComponent extends BaseTerminalTabComponent<TelnetProfile>
}
})
this.frontendReady$.pipe(first()).subscribe(() => {
this.initializeSession()
})
super.ngOnInit()
}
protected onFrontendReady (): void {
this.initializeSession()
super.onFrontendReady()
}
protected attachSessionHandlers (): void {
const session = this.session!
this.attachSessionHandler(session.destroyed$, () => {

View file

@ -129,6 +129,7 @@ export class BaseTerminalTabComponent<P extends BaseTerminalProfile> extends Bas
protected output = new Subject<string>()
protected binaryOutput = new Subject<Buffer>()
protected sessionChanged = new Subject<BaseSession|null>()
protected recentInputs = ''
private bellPlayer: HTMLAudioElement
private termContainerSubscriptions = new SubscriptionContainer()
private sessionHandlers = new SubscriptionContainer()
@ -415,6 +416,11 @@ export class BaseTerminalTabComponent<P extends BaseTerminalProfile> extends Bas
this.frontend!.write('\r\n\r\n')
}
}
this.input$.subscribe(data => {
this.recentInputs += data
this.recentInputs = this.recentInputs.substring(this.recentInputs.length - 32)
})
}
async buildContextMenu (): Promise<MenuItemOptions[]> {