Skip to content

Commit

Permalink
fix: mitigates Vuetify bug filtering items ahead (#992)
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Lamas <[email protected]>
  • Loading branch information
pedrolamas authored Dec 23, 2022
1 parent 920d817 commit 7e477ee
Showing 1 changed file with 30 additions and 31 deletions.
61 changes: 30 additions & 31 deletions src/components/widgets/filesystem/FileSystem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -303,24 +303,7 @@ export default class FileSystem extends Mixins(StateMixin, FilesMixin, ServicesM
{ text: '', value: 'data-table-icons', sortable: false, width: '24px' },
{
text: this.$t('app.general.table.header.name'),
value: 'name',
filter: (value: string) => {
for (const filter of this.filters) {
switch (filter) {
case 'hidden_files':
if (value.match(/^\.(?!\.$)/)) {
return false
}
break
case 'klipper_backup_files':
if (value.match(/^printer-\d{8}_\d{6}\.cfg$/)) {
return false
}
break
}
}
return true
}
value: 'name'
}
]
Expand Down Expand Up @@ -348,18 +331,6 @@ export default class FileSystem extends Mixins(StateMixin, FilesMixin, ServicesM
{
text: this.$t('app.general.table.header.last_printed'),
value: 'print_start_time',
filter: (value: string, search: string | null, item: FileBrowserEntry | AppFileWithMeta) => {
for (const filter of this.filters) {
switch (filter) {
case 'print_start_time':
if (item.type === 'file' && value !== null) {
return false
}
break
}
}
return true
},
configurable: true
}
]
Expand Down Expand Up @@ -413,7 +384,35 @@ export default class FileSystem extends Mixins(StateMixin, FilesMixin, ServicesM
return this.transformTimelapseItems(files)
}
return files
const filteredFiles = files.filter(file => {
if (file.type !== 'file') {
return true
}
for (const filter of this.filters) {
switch (filter) {
case 'hidden_files':
if (file.name?.match(/^\.(?!\.$)/)) {
return false
}
break
case 'klipper_backup_files':
if (file.name?.match(/^printer-\d{8}_\d{6}\.cfg$/)) {
return false
}
break
case 'print_start_time':
if (file.print_start_time !== null) {
return false
}
break
}
}
return true
})
return filteredFiles
}
getAllFiles (): FileBrowserEntry[] {
Expand Down

0 comments on commit 7e477ee

Please sign in to comment.