Skip to content

Commit

Permalink
feat(FileSystem): add crowsnest backup file filter (#1332)
Browse files Browse the repository at this point in the history
Signed-off-by: Mathis Mensing <github@matmen.dev>
  • Loading branch information
matmen committed Jan 29, 2024
1 parent 1bb738a commit 1a273dd
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/components/widgets/filesystem/FileSystem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,12 @@ export default class FileSystem extends Mixins(StateMixin, FilesMixin, ServicesM
return false
}
break
case 'crowsnest_backup_files':
if (file.type === 'file' && file.filename.match(/^crowsnest\.conf\.\d{4}-\d{2}-\d{2}-\d{4}$/)) {
return false
}
break
}
}
Expand Down
7 changes: 7 additions & 0 deletions src/components/widgets/filesystem/FileSystemFilterMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@ export default class FileSystemFilterMenu extends Vue {
})
}
if (rootFilterTypes.includes('crowsnest_backup_files')) {
filters.push({
type: 'crowsnest_backup_files',
text: this.$tc('app.file_system.filters.label.crowsnest_backup_files')
})
}
return filters
}
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ app:
file_system:
filters:
label:
crowsnest_backup_files: Filter Crowsnest backup files
print_start_time: Filter printed
print_start_time_desc: Filters out items you've already printed.
hidden_files_folders: Filter hidden files and folders
Expand Down
2 changes: 1 addition & 1 deletion src/store/files/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export const getters: GetterTree<FilesState, RootState> = {
accepts: ['.conf', '.cfg', '.md', '.css', '.jpg', '.jpeg', '.png', '.gif'],
canView,
canConfigure: false,
filterTypes: ['hidden_files', 'klipper_backup_files', 'moonraker_backup_files']
filterTypes: ['hidden_files', 'klipper_backup_files', 'moonraker_backup_files', 'crowsnest_backup_files']
}
case 'config_examples':
return {
Expand Down
2 changes: 1 addition & 1 deletion src/store/files/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export interface FilesUpload extends FileDownload {
cancelled: boolean; // in a cancelled state, don't show - nor try to upload.
}

export type FileFilterType = 'print_start_time' | 'hidden_files' | 'klipper_backup_files' | 'rolled_log_files' | 'moonraker_backup_files'
export type FileFilterType = 'print_start_time' | 'hidden_files' | 'klipper_backup_files' | 'rolled_log_files' | 'moonraker_backup_files' | 'crowsnest_backup_files'

export type FileBrowserEntry = AppFile | AppFileWithMeta | AppDirectory

Expand Down

0 comments on commit 1a273dd

Please sign in to comment.