Skip to content

Commit

Permalink
feat: add feature to filter moonraker backup files (#1278)
Browse files Browse the repository at this point in the history
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Co-authored-by: Pedro Lamas <pedrolamas@gmail.com>
  • Loading branch information
vajonam and pedrolamas committed Dec 18, 2023
1 parent 8ee1312 commit 66c8d20
Show file tree
Hide file tree
Showing 5 changed files with 13 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 @@ -394,6 +394,12 @@ export default class FileSystem extends Mixins(StateMixin, FilesMixin, ServicesM
}
break
case 'moonraker_backup_files':
if (file.type === 'file' && file.filename === '.moonraker.conf.bkp') {
return false
}
break
case 'klipper_backup_files':
if (file.type === 'file' && file.filename.match(/^printer-\d{8}_\d{6}\.cfg$/)) {
return false
Expand Down
4 changes: 4 additions & 0 deletions src/components/widgets/filesystem/FileSystemFilterMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ export default class FileSystemFilterMenu extends Vue {
enabled: true,
text: this.$tc('app.file_system.filters.label.klipper_backup_files')
},
moonraker_backup_files: {
enabled: true,
text: this.$tc('app.file_system.filters.label.moonraker_backup_files')
},
rolled_log_files: {
enabled: true,
text: this.$tc('app.file_system.filters.label.rolled_log_files')
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ app:
print_start_time_desc: Filters out items you've already printed.
hidden_files_folders: Filter hidden files and folders
klipper_backup_files: Filter Klipper backup files
moonraker_backup_files: Filter Moonraker backup files
rolled_log_files: Filter rolled log files
label:
dir_name: Directory name
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']
filterTypes: ['hidden_files', 'klipper_backup_files', 'moonraker_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'
export type FileFilterType = 'print_start_time' | 'hidden_files' | 'klipper_backup_files' | 'rolled_log_files' | 'moonraker_backup_files'

export type FileBrowserEntry = AppFile | AppFileWithMeta | AppDirectory

Expand Down

0 comments on commit 66c8d20

Please sign in to comment.