mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-14 16:40:05 +00:00
ref(tabby-terminal): create ConnectableTerminalTabComponent class
This commit is contained in:
parent
fd9505c18f
commit
901181f681
@ -4,7 +4,7 @@ import colors from 'ansi-colors'
|
|||||||
import { Component, Injector } from '@angular/core'
|
import { Component, Injector } from '@angular/core'
|
||||||
import { first } from 'rxjs'
|
import { first } from 'rxjs'
|
||||||
import { GetRecoveryTokenOptions, Platform, SelectorService } from 'tabby-core'
|
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'
|
import { SerialSession, BAUD_RATES, SerialProfile } from '../api'
|
||||||
|
|
||||||
/** @hidden */
|
/** @hidden */
|
||||||
@ -14,7 +14,7 @@ import { SerialSession, BAUD_RATES, SerialProfile } from '../api'
|
|||||||
styleUrls: ['./serialTab.component.scss', ...BaseTerminalTabComponent.styles],
|
styleUrls: ['./serialTab.component.scss', ...BaseTerminalTabComponent.styles],
|
||||||
animations: BaseTerminalTabComponent.animations,
|
animations: BaseTerminalTabComponent.animations,
|
||||||
})
|
})
|
||||||
export class SerialTabComponent extends BaseTerminalTabComponent<SerialProfile> implements Reconnectable {
|
export class SerialTabComponent extends ConnectableTerminalTabComponent<SerialProfile> implements Reconnectable {
|
||||||
session: SerialSession|null = null
|
session: SerialSession|null = null
|
||||||
Platform = Platform
|
Platform = Platform
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import { Component, Injector, HostListener } from '@angular/core'
|
|||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { first } from 'rxjs'
|
import { first } from 'rxjs'
|
||||||
import { GetRecoveryTokenOptions, Platform, ProfilesService, RecoveryToken } from 'tabby-core'
|
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 { SSHService } from '../services/ssh.service'
|
||||||
import { KeyboardInteractivePrompt, SSHSession } from '../session/ssh'
|
import { KeyboardInteractivePrompt, SSHSession } from '../session/ssh'
|
||||||
import { SSHPortForwardingModalComponent } from './sshPortForwardingModal.component'
|
import { SSHPortForwardingModalComponent } from './sshPortForwardingModal.component'
|
||||||
@ -22,7 +22,7 @@ import { SSHMultiplexerService } from '../services/sshMultiplexer.service'
|
|||||||
],
|
],
|
||||||
animations: BaseTerminalTabComponent.animations,
|
animations: BaseTerminalTabComponent.animations,
|
||||||
})
|
})
|
||||||
export class SSHTabComponent extends BaseTerminalTabComponent<SSHProfile> implements Reconnectable {
|
export class SSHTabComponent extends ConnectableTerminalTabComponent<SSHProfile> implements Reconnectable {
|
||||||
Platform = Platform
|
Platform = Platform
|
||||||
sshSession: SSHSession|null = null
|
sshSession: SSHSession|null = null
|
||||||
session: SSHShellSession|null = null
|
session: SSHShellSession|null = null
|
||||||
@ -30,7 +30,6 @@ export class SSHTabComponent extends BaseTerminalTabComponent<SSHProfile> implem
|
|||||||
sftpPath = '/'
|
sftpPath = '/'
|
||||||
enableToolbar = true
|
enableToolbar = true
|
||||||
activeKIPrompt: KeyboardInteractivePrompt|null = null
|
activeKIPrompt: KeyboardInteractivePrompt|null = null
|
||||||
private reconnectOffered = false
|
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
injector: Injector,
|
injector: Injector,
|
||||||
|
@ -3,7 +3,7 @@ import colors from 'ansi-colors'
|
|||||||
import { Component, Injector } from '@angular/core'
|
import { Component, Injector } from '@angular/core'
|
||||||
import { first } from 'rxjs'
|
import { first } from 'rxjs'
|
||||||
import { GetRecoveryTokenOptions, Platform, RecoveryToken } from 'tabby-core'
|
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'
|
import { TelnetProfile, TelnetSession } from '../session'
|
||||||
|
|
||||||
|
|
||||||
@ -14,10 +14,9 @@ import { TelnetProfile, TelnetSession } from '../session'
|
|||||||
styleUrls: ['./telnetTab.component.scss', ...BaseTerminalTabComponent.styles],
|
styleUrls: ['./telnetTab.component.scss', ...BaseTerminalTabComponent.styles],
|
||||||
animations: BaseTerminalTabComponent.animations,
|
animations: BaseTerminalTabComponent.animations,
|
||||||
})
|
})
|
||||||
export class TelnetTabComponent extends BaseTerminalTabComponent<TelnetProfile> implements Reconnectable {
|
export class TelnetTabComponent extends ConnectableTerminalTabComponent<TelnetProfile> implements Reconnectable {
|
||||||
Platform = Platform
|
Platform = Platform
|
||||||
session: TelnetSession|null = null
|
session: TelnetSession|null = null
|
||||||
private reconnectOffered = false
|
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
||||||
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 { TerminalDecorator, TerminalContextMenuItemProvider, TerminalColorSchemeProvider }
|
||||||
export { Frontend, XTermFrontend, XTermWebGLFrontend }
|
export { Frontend, XTermFrontend, XTermWebGLFrontend }
|
||||||
export { BaseTerminalTabComponent } from './api/baseTerminalTab.component'
|
export { BaseTerminalTabComponent } from './api/baseTerminalTab.component'
|
||||||
|
export { ConnectableTerminalTabComponent } from './api/connectableTerminalTab.component'
|
||||||
export * from './api/interfaces'
|
export * from './api/interfaces'
|
||||||
export * from './middleware/streamProcessing'
|
export * from './middleware/streamProcessing'
|
||||||
export * from './middleware/loginScriptProcessing'
|
export * from './middleware/loginScriptProcessing'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user