fixed jump hosts using a partial profile - fixes #3294, fixes #4307, fixes #4396

This commit is contained in:
Eugene Pankov 2021-08-15 13:38:11 +02:00
parent 8b33f98c79
commit 101177a865
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4
2 changed files with 9 additions and 5 deletions

View File

@ -2,7 +2,7 @@
import { Component, ViewChild } from '@angular/core'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { ConfigService, FileProvidersService, Platform, HostAppService, PromptModalComponent } from 'tabby-core'
import { ConfigService, FileProvidersService, Platform, HostAppService, PromptModalComponent, PartialProfile } from 'tabby-core'
import { LoginScriptsSettingsComponent } from 'tabby-terminal'
import { PasswordStorageService } from '../services/passwordStorage.service'
import { ForwardedPortConfig, SSHAlgorithmType, SSHProfile } from '../api'
@ -20,7 +20,7 @@ export class SSHProfileSettingsComponent {
supportedAlgorithms = supportedAlgorithms
algorithms: Record<string, Record<string, boolean>> = {}
jumpHosts: SSHProfile[]
jumpHosts: PartialProfile<SSHProfile>[]
@ViewChild('loginScriptsSettings') loginScriptsSettings: LoginScriptsSettingsComponent|null
constructor (

View File

@ -2,7 +2,7 @@ import colors from 'ansi-colors'
import { Component, Injector, HostListener } from '@angular/core'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { first } from 'rxjs'
import { Platform, RecoveryToken } from 'tabby-core'
import { PartialProfile, Platform, ProfilesService, RecoveryToken } from 'tabby-core'
import { BaseTerminalTabComponent } from 'tabby-terminal'
import { SSHService } from '../services/ssh.service'
import { SSHSession } from '../session/ssh'
@ -32,6 +32,7 @@ export class SSHTabComponent extends BaseTerminalTabComponent {
injector: Injector,
public ssh: SSHService,
private ngbModal: NgbModal,
private profilesService: ProfilesService,
) {
super(injector)
}
@ -78,13 +79,16 @@ export class SSHTabComponent extends BaseTerminalTabComponent {
async setupOneSession (session: SSHSession): Promise<void> {
if (session.profile.options.jumpHost) {
const jumpConnection: SSHProfile|null = this.config.store.profiles.find(x => x.id === session.profile.options.jumpHost)
const jumpConnection: PartialProfile<SSHProfile>|null = this.config.store.profiles.find(x => x.id === session.profile.options.jumpHost)
if (!jumpConnection) {
throw new Error(`${session.profile.options.host}: jump host "${session.profile.options.jumpHost}" not found in your config`)
}
const jumpSession = new SSHSession(this.injector, jumpConnection)
const jumpSession = new SSHSession(
this.injector,
this.profilesService.getConfigProxyForProfile(jumpConnection)
)
await this.setupOneSession(jumpSession)