ref(core/settings/serial/ssh/telnet): create ConnectableProfile & ConnectableProfileProvider Eugeny/tabby#8416

This commit is contained in:
Clem
2023-08-14 14:14:57 +02:00
parent 2262d59866
commit 21e38c8453
17 changed files with 56 additions and 42 deletions

View File

@@ -1,4 +1,4 @@
import { BaseTerminalProfile, InputProcessingOptions, LoginScriptsOptions } from 'tabby-terminal'
import { ConnectableTerminalProfile, InputProcessingOptions, LoginScriptsOptions } from 'tabby-terminal'
export enum SSHAlgorithmType {
HMAC = 'hmac',
@@ -7,7 +7,7 @@ export enum SSHAlgorithmType {
HOSTKEY = 'serverHostKey',
}
export interface SSHProfile extends BaseTerminalProfile {
export interface SSHProfile extends ConnectableTerminalProfile {
options: SSHProfileOptions
}

View File

@@ -83,7 +83,7 @@ export class SSHTabComponent extends ConnectableTerminalTabComponent<SSHProfile>
const jumpSession = await this.setupOneSession(
this.injector,
this.profilesService.getConfigProxyForProfile(jumpConnection),
this.profilesService.getConfigProxyForProfile<SSHProfile>(jumpConnection),
)
jumpSession.ref()

View File

@@ -1,5 +1,5 @@
import { Injectable, InjectFlags, Injector } from '@angular/core'
import { ProfileProvider, NewTabParameters, PartialProfile, TranslateService } from 'tabby-core'
import { NewTabParameters, PartialProfile, TranslateService, ConnectableProfileProvider } from 'tabby-core'
import * as ALGORITHMS from 'ssh2/lib/protocol/constants'
import { SSHProfileSettingsComponent } from './components/sshProfileSettings.component'
import { SSHTabComponent } from './components/sshTab.component'
@@ -8,10 +8,9 @@ import { ALGORITHM_BLACKLIST, SSHAlgorithmType, SSHProfile } from './api'
import { SSHProfileImporter } from './api/importer'
@Injectable({ providedIn: 'root' })
export class SSHProfilesService extends ProfileProvider<SSHProfile> {
export class SSHProfilesService extends ConnectableProfileProvider<SSHProfile> {
id = 'ssh'
name = 'SSH'
supportsQuickConnect = true
settingsComponent = SSHProfileSettingsComponent
configDefaults = {
options: {

View File

@@ -34,7 +34,7 @@ export class SSHMultiplexerService {
if (!jumpConnection) {
return key
}
const jumpProfile = this.profilesService.getConfigProxyForProfile(jumpConnection)
const jumpProfile = this.profilesService.getConfigProxyForProfile<SSHProfile>(jumpConnection)
key += '$' + await this.getMultiplexerKey(jumpProfile)
}
return key