diff options
Diffstat (limited to 'apps/files/src/components/FilesListVirtual.vue')
-rw-r--r-- | apps/files/src/components/FilesListVirtual.vue | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/apps/files/src/components/FilesListVirtual.vue b/apps/files/src/components/FilesListVirtual.vue index 9a35e9ff855..782e2bd3587 100644 --- a/apps/files/src/components/FilesListVirtual.vue +++ b/apps/files/src/components/FilesListVirtual.vue @@ -4,7 +4,7 @@ --> <template> <VirtualList ref="table" - :data-component="userConfig.grid_view ? FileEntryGrid : FileEntry" + :data-component="fileEntryComponent" :data-key="'source'" :data-sources="nodes" :grid-mode="userConfig.grid_view" @@ -132,8 +132,6 @@ export default defineComponent({ data() { return { - FileEntry, - FileEntryGrid, headers: getFileListHeaders(), scrollToIndex: 0, openFileId: null as number|null, @@ -141,6 +139,13 @@ export default defineComponent({ }, computed: { + /** + * The Vue component to use for file list entries + */ + fileEntryComponent() { + return this.userConfig.grid_view ? FileEntryGrid : FileEntry + }, + userConfig(): UserConfig { return this.userConfigStore.userConfig }, @@ -218,6 +223,11 @@ export default defineComponent({ }, methods: { + reset() { + this.scrollToIndex = 0 + this.openFileId = null + }, + // Open the file sidebar if we have the room for it // but don't open the sidebar for the current folder openSidebarForFile(fileId) { @@ -236,6 +246,10 @@ export default defineComponent({ if (fileId) { const index = this.nodes.findIndex(node => node.fileid === fileId) if (warn && index === -1 && fileId !== this.currentFolder.fileid) { + logger.error('File to scroll to not found', { + folder: this.currentFolder, + fileId, + }) showError(this.t('files', 'File not found')) } this.scrollToIndex = Math.max(0, index) |