mirror of
https://github.com/Eugeny/tabby
synced 2024-11-14 08:57:21 +00:00
ref(tabby-terminal): create ConnectableTerminalTabComponent class
This commit is contained in:
parent
fd9505c18f
commit
901181f681
5 changed files with 33 additions and 8 deletions
|
@ -4,7 +4,7 @@ import colors from 'ansi-colors'
|
|||
import { Component, Injector } from '@angular/core'
|
||||
import { first } from 'rxjs'
|
||||
import { GetRecoveryTokenOptions, Platform, SelectorService } from 'tabby-core'
|
||||
import { BaseTerminalTabComponent, Reconnectable } from 'tabby-terminal'
|
||||
import { BaseTerminalTabComponent, ConnectableTerminalTabComponent, Reconnectable } from 'tabby-terminal'
|
||||
import { SerialSession, BAUD_RATES, SerialProfile } from '../api'
|
||||
|
||||
/** @hidden */
|
||||
|
@ -14,7 +14,7 @@ import { SerialSession, BAUD_RATES, SerialProfile } from '../api'
|
|||
styleUrls: ['./serialTab.component.scss', ...BaseTerminalTabComponent.styles],
|
||||
animations: BaseTerminalTabComponent.animations,
|
||||
})
|
||||
export class SerialTabComponent extends BaseTerminalTabComponent<SerialProfile> implements Reconnectable {
|
||||
export class SerialTabComponent extends ConnectableTerminalTabComponent<SerialProfile> implements Reconnectable {
|
||||
session: SerialSession|null = null
|
||||
Platform = Platform
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import { Component, Injector, HostListener } from '@angular/core'
|
|||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { first } from 'rxjs'
|
||||
import { GetRecoveryTokenOptions, Platform, ProfilesService, RecoveryToken } from 'tabby-core'
|
||||
import { BaseTerminalTabComponent, Reconnectable } from 'tabby-terminal'
|
||||
import { BaseTerminalTabComponent, ConnectableTerminalTabComponent, Reconnectable } from 'tabby-terminal'
|
||||
import { SSHService } from '../services/ssh.service'
|
||||
import { KeyboardInteractivePrompt, SSHSession } from '../session/ssh'
|
||||
import { SSHPortForwardingModalComponent } from './sshPortForwardingModal.component'
|
||||
|
@ -22,7 +22,7 @@ import { SSHMultiplexerService } from '../services/sshMultiplexer.service'
|
|||
],
|
||||
animations: BaseTerminalTabComponent.animations,
|
||||
})
|
||||
export class SSHTabComponent extends BaseTerminalTabComponent<SSHProfile> implements Reconnectable {
|
||||
export class SSHTabComponent extends ConnectableTerminalTabComponent<SSHProfile> implements Reconnectable {
|
||||
Platform = Platform
|
||||
sshSession: SSHSession|null = null
|
||||
session: SSHShellSession|null = null
|
||||
|
@ -30,7 +30,6 @@ export class SSHTabComponent extends BaseTerminalTabComponent<SSHProfile> implem
|
|||
sftpPath = '/'
|
||||
enableToolbar = true
|
||||
activeKIPrompt: KeyboardInteractivePrompt|null = null
|
||||
private reconnectOffered = false
|
||||
|
||||
constructor (
|
||||
injector: Injector,
|
||||
|
|
|
@ -3,7 +3,7 @@ import colors from 'ansi-colors'
|
|||
import { Component, Injector } from '@angular/core'
|
||||
import { first } from 'rxjs'
|
||||
import { GetRecoveryTokenOptions, Platform, RecoveryToken } from 'tabby-core'
|
||||
import { BaseTerminalTabComponent, Reconnectable } from 'tabby-terminal'
|
||||
import { BaseTerminalTabComponent, ConnectableTerminalTabComponent, Reconnectable } from 'tabby-terminal'
|
||||
import { TelnetProfile, TelnetSession } from '../session'
|
||||
|
||||
|
||||
|
@ -14,10 +14,9 @@ import { TelnetProfile, TelnetSession } from '../session'
|
|||
styleUrls: ['./telnetTab.component.scss', ...BaseTerminalTabComponent.styles],
|
||||
animations: BaseTerminalTabComponent.animations,
|
||||
})
|
||||
export class TelnetTabComponent extends BaseTerminalTabComponent<TelnetProfile> implements Reconnectable {
|
||||
export class TelnetTabComponent extends ConnectableTerminalTabComponent<TelnetProfile> implements Reconnectable {
|
||||
Platform = Platform
|
||||
session: TelnetSession|null = null
|
||||
private reconnectOffered = false
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
||||
constructor (
|
||||
|
|
26
tabby-terminal/src/api/connectableTerminalTab.component.ts
Normal file
26
tabby-terminal/src/api/connectableTerminalTab.component.ts
Normal file
|
@ -0,0 +1,26 @@
|
|||
import { Injector, Component } from '@angular/core'
|
||||
|
||||
import { BaseTerminalProfile } from './interfaces'
|
||||
import { BaseTerminalTabComponent } from './baseTerminalTab.component'
|
||||
|
||||
/**
|
||||
* A class to base your custom connectable terminal tabs on
|
||||
*/
|
||||
@Component({ template: '' })
|
||||
export abstract class ConnectableTerminalTabComponent<P extends BaseTerminalProfile> extends BaseTerminalTabComponent<P> {
|
||||
|
||||
protected reconnectOffered = false
|
||||
|
||||
constructor (protected injector: Injector) {
|
||||
super(injector)
|
||||
}
|
||||
|
||||
abstract initializeSession (): Promise<void>
|
||||
|
||||
async reconnect (): Promise<void> {
|
||||
this.session?.destroy()
|
||||
await this.initializeSession()
|
||||
this.session?.releaseInitialDataBuffer()
|
||||
}
|
||||
|
||||
}
|
|
@ -90,6 +90,7 @@ export default class TerminalModule { } // eslint-disable-line @typescript-eslin
|
|||
export { TerminalDecorator, TerminalContextMenuItemProvider, TerminalColorSchemeProvider }
|
||||
export { Frontend, XTermFrontend, XTermWebGLFrontend }
|
||||
export { BaseTerminalTabComponent } from './api/baseTerminalTab.component'
|
||||
export { ConnectableTerminalTabComponent } from './api/connectableTerminalTab.component'
|
||||
export * from './api/interfaces'
|
||||
export * from './middleware/streamProcessing'
|
||||
export * from './middleware/loginScriptProcessing'
|
||||
|
|
Loading…
Reference in a new issue