mirror of
https://github.com/Eugeny/tabby.git
synced 2025-09-27 10:36:03 +00:00
Compare commits
1 Commits
b31c2a5c11
...
v1.0.224
Author | SHA1 | Date | |
---|---|---|---|
![]() |
56ee368b63 |
@@ -17,6 +17,10 @@
|
|||||||
|
|
||||||
.breadcrumb-spacer.flex-grow-1.h-100((dblclick)='editPath()')
|
.breadcrumb-spacer.flex-grow-1.h-100((dblclick)='editPath()')
|
||||||
|
|
||||||
|
button.btn.btn-link.btn-sm.flex-shrink-0.d-flex(*ngIf='!showFilter', (click)='showFilter = true')
|
||||||
|
i.fas.fa-filter.me-1
|
||||||
|
div(translate) Filter
|
||||||
|
|
||||||
button.btn.btn-link.btn-sm.flex-shrink-0.d-flex((click)='openCreateDirectoryModal()')
|
button.btn.btn-link.btn-sm.flex-shrink-0.d-flex((click)='openCreateDirectoryModal()')
|
||||||
i.fas.fa-plus.me-1
|
i.fas.fa-plus.me-1
|
||||||
div(translate) Create directory
|
div(translate) Create directory
|
||||||
@@ -31,6 +35,19 @@
|
|||||||
|
|
||||||
button.btn.btn-link.text-decoration-none((click)='close()') !{require('../../../tabby-core/src/icons/times.svg')}
|
button.btn.btn-link.text-decoration-none((click)='close()') !{require('../../../tabby-core/src/icons/times.svg')}
|
||||||
|
|
||||||
|
.filter-bar.px-3.py-2.border-bottom(*ngIf='showFilter')
|
||||||
|
.input-group
|
||||||
|
input.form-control(
|
||||||
|
type='text',
|
||||||
|
placeholder='Filter...',
|
||||||
|
autofocus,
|
||||||
|
[(ngModel)]='filterText',
|
||||||
|
(input)='onFilterChange()',
|
||||||
|
(keydown.escape)='clearFilter()'
|
||||||
|
)
|
||||||
|
button.btn.btn-secondary((click)='clearFilter()')
|
||||||
|
i.fas.fa-times
|
||||||
|
|
||||||
.body(dropZone, (transfer)='uploadOneFolder($event)')
|
.body(dropZone, (transfer)='uploadOneFolder($event)')
|
||||||
a.alert.alert-info.d-flex.align-items-center(
|
a.alert.alert-info.d-flex.align-items-center(
|
||||||
*ngIf='shouldShowCWDTip && !cwdDetectionAvailable',
|
*ngIf='shouldShowCWDTip && !cwdDetectionAvailable',
|
||||||
@@ -47,13 +64,13 @@
|
|||||||
div(*ngIf='fileList === null', translate) Loading
|
div(*ngIf='fileList === null', translate) Loading
|
||||||
.list-group.list-group-light(*ngIf='fileList !== null')
|
.list-group.list-group-light(*ngIf='fileList !== null')
|
||||||
.list-group-item.list-group-item-action.d-flex.align-items-center(
|
.list-group-item.list-group-item-action.d-flex.align-items-center(
|
||||||
*ngIf='path !== "/"',
|
*ngIf='path !== "/" && (!showFilter || filterText.trim() === "")',
|
||||||
(click)='goUp()'
|
(click)='goUp()'
|
||||||
)
|
)
|
||||||
i.fas.fa-fw.fa-level-up-alt
|
i.fas.fa-fw.fa-level-up-alt
|
||||||
div(translate) Go up
|
div(translate) Go up
|
||||||
.list-group-item.list-group-item-action.d-flex.align-items-center(
|
.list-group-item.list-group-item-action.d-flex.align-items-center(
|
||||||
*ngFor='let item of fileList',
|
*ngFor='let item of filteredFileList',
|
||||||
(contextmenu)='showContextMenu(item, $event)',
|
(contextmenu)='showContextMenu(item, $event)',
|
||||||
(click)='open(item)'
|
(click)='open(item)'
|
||||||
)
|
)
|
||||||
@@ -63,3 +80,6 @@
|
|||||||
.size(*ngIf='!item.isDirectory') {{item.size|filesize}}
|
.size(*ngIf='!item.isDirectory') {{item.size|filesize}}
|
||||||
.date {{item.modified|tabbyDate}}
|
.date {{item.modified|tabbyDate}}
|
||||||
.mode {{getModeString(item)}}
|
.mode {{getModeString(item)}}
|
||||||
|
.alert.alert-info.text-center.mt-3(*ngIf='fileList !== null && filteredFileList.length === 0 && showFilter && filterText.trim() !== ""')
|
||||||
|
i.fas.fa-search.me-2
|
||||||
|
span(translate) No files match the filter "{{filterText}}"
|
||||||
|
@@ -9,6 +9,10 @@
|
|||||||
flex: none;
|
flex: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
> .filter-bar {
|
||||||
|
flex: none;
|
||||||
|
}
|
||||||
|
|
||||||
> .body {
|
> .body {
|
||||||
padding: 10px 20px;
|
padding: 10px 20px;
|
||||||
flex: 1 1 0;
|
flex: 1 1 0;
|
||||||
|
@@ -23,11 +23,14 @@ export class SFTPPanelComponent {
|
|||||||
@Output() closed = new EventEmitter<void>()
|
@Output() closed = new EventEmitter<void>()
|
||||||
sftp: SFTPSession
|
sftp: SFTPSession
|
||||||
fileList: SFTPFile[]|null = null
|
fileList: SFTPFile[]|null = null
|
||||||
|
filteredFileList: SFTPFile[] = []
|
||||||
@Input() path = '/'
|
@Input() path = '/'
|
||||||
@Output() pathChange = new EventEmitter<string>()
|
@Output() pathChange = new EventEmitter<string>()
|
||||||
pathSegments: PathSegment[] = []
|
pathSegments: PathSegment[] = []
|
||||||
@Input() cwdDetectionAvailable = false
|
@Input() cwdDetectionAvailable = false
|
||||||
editingPath: string|null = null
|
editingPath: string|null = null
|
||||||
|
showFilter = false
|
||||||
|
filterText = ''
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
private ngbModal: NgbModal,
|
private ngbModal: NgbModal,
|
||||||
@@ -54,6 +57,8 @@ export class SFTPPanelComponent {
|
|||||||
this.path = newPath
|
this.path = newPath
|
||||||
this.pathChange.next(this.path)
|
this.pathChange.next(this.path)
|
||||||
|
|
||||||
|
this.clearFilter()
|
||||||
|
|
||||||
let p = newPath
|
let p = newPath
|
||||||
this.pathSegments = []
|
this.pathSegments = []
|
||||||
while (p !== '/') {
|
while (p !== '/') {
|
||||||
@@ -65,6 +70,7 @@ export class SFTPPanelComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.fileList = null
|
this.fileList = null
|
||||||
|
this.filteredFileList = []
|
||||||
try {
|
try {
|
||||||
this.fileList = await this.sftp.readdir(this.path)
|
this.fileList = await this.sftp.readdir(this.path)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -79,6 +85,8 @@ export class SFTPPanelComponent {
|
|||||||
this.fileList.sort((a, b) =>
|
this.fileList.sort((a, b) =>
|
||||||
dirKey(b) - dirKey(a) ||
|
dirKey(b) - dirKey(a) ||
|
||||||
a.name.localeCompare(b.name))
|
a.name.localeCompare(b.name))
|
||||||
|
|
||||||
|
this.updateFilteredList()
|
||||||
}
|
}
|
||||||
|
|
||||||
getFileType (fileExtension: string): string {
|
getFileType (fileExtension: string): string {
|
||||||
@@ -336,4 +344,29 @@ export class SFTPPanelComponent {
|
|||||||
this.closed.emit()
|
this.closed.emit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearFilter (): void {
|
||||||
|
this.showFilter = false
|
||||||
|
this.filterText = ''
|
||||||
|
this.updateFilteredList()
|
||||||
|
}
|
||||||
|
|
||||||
|
onFilterChange (): void {
|
||||||
|
this.updateFilteredList()
|
||||||
|
}
|
||||||
|
|
||||||
|
private updateFilteredList (): void {
|
||||||
|
if (!this.fileList) {
|
||||||
|
this.filteredFileList = []
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.showFilter || this.filterText.trim() === '') {
|
||||||
|
this.filteredFileList = this.fileList
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.filteredFileList = this.fileList.filter(item =>
|
||||||
|
item.name.toLowerCase().includes(this.filterText.toLowerCase()),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user