mirror of
https://github.com/Eugeny/tabby.git
synced 2025-10-04 22:14:55 +00:00
fixes
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { Component, NgZone } from '@angular/core'
|
||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { ToastrService } from 'ngx-toastr'
|
||||
import { ConfigService, AppService } from 'terminus-core'
|
||||
import { SettingsTabComponent } from 'terminus-settings'
|
||||
import { SSHService } from '../services/ssh.service'
|
||||
import { SSHConnection, SSHConnectionGroup } from '../api'
|
||||
import { SSHTabComponent } from './sshTab.component'
|
||||
|
||||
/** @hidden */
|
||||
@Component({
|
||||
@@ -22,9 +22,9 @@ export class SSHModalComponent {
|
||||
constructor (
|
||||
public modalInstance: NgbActiveModal,
|
||||
private config: ConfigService,
|
||||
private ssh: SSHService,
|
||||
private app: AppService,
|
||||
private toastr: ToastrService,
|
||||
private zone: NgZone,
|
||||
) { }
|
||||
|
||||
ngOnInit () {
|
||||
@@ -63,15 +63,24 @@ export class SSHModalComponent {
|
||||
this.lastConnection = null
|
||||
}
|
||||
|
||||
connect (connection: SSHConnection) {
|
||||
async connect (connection: SSHConnection) {
|
||||
this.close()
|
||||
this.ssh.openTab(connection).catch(error => {
|
||||
this.toastr.error(`Could not connect: ${error}`)
|
||||
}).then(() => {
|
||||
|
||||
try {
|
||||
const tab = this.zone.run(() => this.app.openNewTab(
|
||||
SSHTabComponent,
|
||||
{ connection }
|
||||
) as SSHTabComponent)
|
||||
if (connection.color) {
|
||||
(this.app.getParentTab(tab) || tab).color = connection.color
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
this.app.activeTab.emitFocused()
|
||||
this.app.activeTab?.emitFocused()
|
||||
})
|
||||
})
|
||||
} catch (error) {
|
||||
this.toastr.error(`Could not connect: ${error}`)
|
||||
}
|
||||
}
|
||||
|
||||
manageConnections () {
|
||||
|
@@ -8,10 +8,9 @@ import { execFile } from 'mz/child_process'
|
||||
import * as path from 'path'
|
||||
import * as sshpk from 'sshpk'
|
||||
import { ToastrService } from 'ngx-toastr'
|
||||
import { AppService, HostAppService, Platform, Logger, LogService, ElectronService } from 'terminus-core'
|
||||
import { HostAppService, Platform, Logger, LogService, ElectronService } from 'terminus-core'
|
||||
import { SSHConnection, SSHSession } from '../api'
|
||||
import { PromptModalComponent } from '../components/promptModal.component'
|
||||
import { SSHTabComponent } from '../components/sshTab.component'
|
||||
import { PasswordStorageService } from './passwordStorage.service'
|
||||
import { SSH2Stream } from 'ssh2-streams'
|
||||
|
||||
@@ -25,7 +24,6 @@ export class SSHService {
|
||||
|
||||
private constructor (
|
||||
private log: LogService,
|
||||
private app: AppService,
|
||||
private electron: ElectronService,
|
||||
private zone: NgZone,
|
||||
private ngbModal: NgbModal,
|
||||
@@ -36,17 +34,6 @@ export class SSHService {
|
||||
this.logger = log.create('ssh')
|
||||
}
|
||||
|
||||
async openTab (connection: SSHConnection): Promise<SSHTabComponent> {
|
||||
const tab = this.zone.run(() => this.app.openNewTab(
|
||||
SSHTabComponent,
|
||||
{ connection }
|
||||
) as SSHTabComponent)
|
||||
if (connection.color) {
|
||||
(this.app.getParentTab(tab) || tab).color = connection.color
|
||||
}
|
||||
return tab
|
||||
}
|
||||
|
||||
createSession (connection: SSHConnection): SSHSession {
|
||||
const session = new SSHSession(connection)
|
||||
session.logger = this.log.create(`ssh-${connection.host}-${connection.port}`)
|
||||
|
Reference in New Issue
Block a user