Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tabby-core/src/hotkeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ export class AppHotkeyProvider extends HotkeyProvider {
id: 'pane-decrease-horizontal',
name: this.translate.instant('Decrease horizontal split size'),
},
{
id: 'toggle-sftp-pane',
name: this.translate.instant('Toggle SFTP panel'),
},
]

constructor (
Expand Down
5 changes: 5 additions & 0 deletions tabby-ssh/src/components/sftpPanel.component.pug
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
button.btn.btn-link.btn-sm.flex-shrink-0.d-flex((click)='upload()')
i.fas.fa-upload.me-1
div(translate) Upload

button.btn.btn-link.btn-sm.flex-shrink-0.d-flex((click)='togglePinSFTPPanel()')
i.fas.fa-thumbtack
span(*ngIf='pinSFTPPanel', translate) Unpin
span(*ngIf='!pinSFTPPanel', translate) Pin

button.btn.btn-link.text-decoration-none((click)='close()') !{require('../../../tabby-core/src/icons/times.svg')}

Expand Down
9 changes: 8 additions & 1 deletion tabby-ssh/src/components/sftpPanel.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as C from 'constants'
import { posix as path } from 'path'
import { Component, Input, Output, EventEmitter, Inject, Optional } from '@angular/core'
import { Component, Input, Output, EventEmitter, Inject, Optional, HostBinding } from '@angular/core'
import { FileUpload, MenuItemOptions, NotificationsService, PlatformService } from 'tabby-core'
import { SFTPSession, SFTPFile } from '../session/sftp'
import { SSHSession } from '../session/ssh'
Expand Down Expand Up @@ -28,6 +28,8 @@ export class SFTPPanelComponent {
pathSegments: PathSegment[] = []
@Input() cwdDetectionAvailable = false
editingPath: string|null = null
@HostBinding('class.pinned') pinSFTPPanel = false
@Output() pinStateChange = new EventEmitter<boolean>()

constructor (
private ngbModal: NgbModal,
Expand Down Expand Up @@ -246,6 +248,11 @@ export class SFTPPanelComponent {
this.editingPath = null
}

togglePinSFTPPanel (): void {
this.pinSFTPPanel = !this.pinSFTPPanel
this.pinStateChange.emit(this.pinSFTPPanel)
}

close (): void {
this.closed.emit()
}
Expand Down
31 changes: 29 additions & 2 deletions tabby-ssh/src/components/sshTab.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'
import colors from 'ansi-colors'
import { Component, Injector, HostListener } from '@angular/core'
import { Component, Injector, HostListener, ViewChild } from '@angular/core'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { Platform, ProfilesService } from 'tabby-core'
import { BaseTerminalTabComponent, ConnectableTerminalTabComponent } from 'tabby-terminal'
Expand All @@ -10,6 +10,7 @@ import { SSHPortForwardingModalComponent } from './sshPortForwardingModal.compon
import { SSHProfile } from '../api'
import { SSHShellSession } from '../session/shell'
import { SSHMultiplexerService } from '../services/sshMultiplexer.service'
import { SFTPPanelComponent } from './sftpPanel.component'

/** @hidden */
@Component({
Expand All @@ -26,9 +27,11 @@ export class SSHTabComponent extends ConnectableTerminalTabComponent<SSHProfile>
sshSession: SSHSession|null = null
session: SSHShellSession|null = null
sftpPanelVisible = false
isSftpPanelPinned = false
sftpPath = '/'
enableToolbar = true
activeKIPrompt: KeyboardInteractivePrompt|null = null
@ViewChild(SFTPPanelComponent, { static: false }) sftpPanel: SFTPPanelComponent

constructor (
injector: Injector,
Expand Down Expand Up @@ -58,6 +61,13 @@ export class SSHTabComponent extends ConnectableTerminalTabComponent<SSHProfile>
case 'restart-ssh-session':
this.reconnect()
break
case 'toggle-sftp-pane':
if (this.sftpPanelVisible) {
this.sftpPanelVisible = false
} else {
this.openSFTP()
}
break
case 'launch-winscp':
if (this.sshSession) {
this.ssh.launchWinSCP(this.sshSession)
Expand Down Expand Up @@ -213,9 +223,26 @@ export class SSHTabComponent extends ConnectableTerminalTabComponent<SSHProfile>
}, 100)
}

ngAfterViewChecked (): void {
if (!this.sftpPanel.pinStateChange.observers.length) {
this.subscribeToPinState()
}
}

subscribeToPinState (): void {
this.sftpPanel.pinStateChange.subscribe((isPinned: boolean) => {
this.isSftpPanelPinned = isPinned
})
this.sftpPanel.closed.subscribe(() => {
this.isSftpPanelPinned = false
})
}

@HostListener('click')
onClick (): void {
this.sftpPanelVisible = false
if (!this.isSftpPanelPinned) {
this.sftpPanelVisible = false
}
}

protected isSessionExplicitlyTerminated (): boolean {
Expand Down