diff --git a/src/api/socketActions.ts b/src/api/socketActions.ts index 7525ae70b3..1351e6812e 100644 --- a/src/api/socketActions.ts +++ b/src/api/socketActions.ts @@ -529,7 +529,7 @@ export const SocketActions = { * Expects the full path including root. * Optionally pass the just the filename and path. */ - async serverFilesMetaData (filepath: string) { + async serverFilesMetadata (filepath: string) { baseEmit( 'server.files.metadata', { dispatch: 'files/onFileMetaData', @@ -538,6 +538,15 @@ export const SocketActions = { ) }, + async serverFilesMetascan (filepath: string) { + baseEmit( + 'server.files.metascan', { + dispatch: 'files/onFileMetaData', + params: { filename: filepath } + } + ) + }, + /** * This only requires path, but we pass root along too * for brevity. diff --git a/src/components/widgets/filesystem/FileSystemContextMenu.vue b/src/components/widgets/filesystem/FileSystemContextMenu.vue index 1f25adc120..f2d0f313ab 100644 --- a/src/components/widgets/filesystem/FileSystemContextMenu.vue +++ b/src/components/widgets/filesystem/FileSystemContextMenu.vue @@ -18,7 +18,6 @@ @@ -74,19 +73,31 @@ @click="$emit('view', file)" > - $magnify + $open {{ $t('app.general.btn.view') }} + + + $sync + + + {{ $t('app.general.btn.refresh_metadata') }} + + + - $magnify + $cubeScan {{ $t('app.general.btn.preview_gcode') }} @@ -107,7 +118,6 @@ @@ -132,7 +142,6 @@ diff --git a/src/globals.ts b/src/globals.ts index e594d0f68a..358120e3d3 100644 --- a/src/globals.ts +++ b/src/globals.ts @@ -142,6 +142,7 @@ import { mdiFolderArrowUp, mdiTableColumn, mdiShape, + mdiSync, mdiContentDuplicate } from '@mdi/js' @@ -316,6 +317,7 @@ export const Icons = Object.freeze({ download: mdiDownload, rename: mdiFormTextbox, duplicate: mdiContentDuplicate, + sync: mdiSync, delete: mdiDelete, camera: mdiCamera, fan: mdiFan, diff --git a/src/locales/en.yaml b/src/locales/en.yaml index 95adb24581..f55a301405 100644 --- a/src/locales/en.yaml +++ b/src/locales/en.yaml @@ -176,6 +176,7 @@ app: reboot: Reboot recover: Recover refresh: Refresh + refresh_metadata: Refresh Metadata reload: Reload remove: Remove remove_all: Remove all diff --git a/src/store/files/actions.ts b/src/store/files/actions.ts index 36cc322d25..31c241c59d 100644 --- a/src/store/files/actions.ts +++ b/src/store/files/actions.ts @@ -99,7 +99,7 @@ export const actions: ActionTree = { } // For gcode files, get the metadata and the meta update will take care of the rest. - SocketActions.serverFilesMetaData(payload.item.path) + SocketActions.serverFilesMetadata(payload.item.path) } else { const paths = getFilePaths(payload.item.path, root) const update: FileUpdate = { diff --git a/src/store/helpers.ts b/src/store/helpers.ts index c4b814e622..586f682043 100644 --- a/src/store/helpers.ts +++ b/src/store/helpers.ts @@ -67,7 +67,7 @@ export const handleCurrentFileChange = (payload: any, state: RootState, commit: // This refreshes the metadata for the current file, which also // ensures we update the current_file with the latest data via // the files/onFileUpdate action. - SocketActions.serverFilesMetaData(payload.print_stats.filename) + SocketActions.serverFilesMetadata(payload.print_stats.filename) } } }