allow editing the current SFTP path by double-clicking - #7154, fixed #7291, fixed #7295, fixed #6666, fixed #6646, fixed #6354, fixed #5646

This commit is contained in:
Eugene Pankov 2023-01-08 20:23:23 +01:00
parent 24f8a4bd43
commit 1397d0faed
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4
2 changed files with 25 additions and 1 deletions

View File

@ -1,11 +1,22 @@
.header .header
.breadcrumb.mr-auto input.form-control.flex-grow-1.w-0(
*ngIf='editingPath !== null',
type='text',
autofocus,
(keydown.enter)='confirmPath()',
(keydown.esc)='editingPath = null',
(blur)='editingPath = null',
[(ngModel)]='editingPath'
)
.breadcrumb(*ngIf='editingPath === null', (dblclick)='editPath()')
a.breadcrumb-item((click)='navigate("/")') SFTP a.breadcrumb-item((click)='navigate("/")') SFTP
a.breadcrumb-item( a.breadcrumb-item(
*ngFor='let segment of pathSegments', *ngFor='let segment of pathSegments',
(click)='navigate(segment.path)' (click)='navigate(segment.path)'
) {{segment.name}} ) {{segment.name}}
.breadcrumb-spacer.flex-grow-1.h-100((dblclick)='editPath()')
button.btn.btn-link.btn-sm.d-flex((click)='openCreateDirectoryModal()') button.btn.btn-link.btn-sm.d-flex((click)='openCreateDirectoryModal()')
i.fas.fa-plus.mr-1 i.fas.fa-plus.mr-1
div(translate) Create directory div(translate) Create directory

View File

@ -27,6 +27,7 @@ export class SFTPPanelComponent {
@Output() pathChange = new EventEmitter<string>() @Output() pathChange = new EventEmitter<string>()
pathSegments: PathSegment[] = [] pathSegments: PathSegment[] = []
@Input() cwdDetectionAvailable = false @Input() cwdDetectionAvailable = false
editingPath: string|null = null
constructor ( constructor (
private ngbModal: NgbModal, private ngbModal: NgbModal,
@ -182,6 +183,18 @@ export class SFTPPanelComponent {
window.localStorage.sshCWDTipDismissed = 'true' window.localStorage.sshCWDTipDismissed = 'true'
} }
editPath (): void {
this.editingPath = this.path
}
confirmPath (): void {
if (this.editingPath === null) {
return
}
this.navigate(this.editingPath)
this.editingPath = null
}
close (): void { close (): void {
this.closed.emit() this.closed.emit()
} }