diff --git a/src/store/files.js b/src/store/files.js index d449522a6..8b524405d 100644 --- a/src/store/files.js +++ b/src/store/files.js @@ -28,6 +28,7 @@ export const useFilesStore = function(...args) { loading: false, filterActive: 'all', canRequestSign: loadState('libresign', 'can_request_sign', false), + ordered: [], } }, @@ -35,6 +36,7 @@ export const useFilesStore = function(...args) { addFile(file) { set(this.files, file.nodeId, file) this.hydrateFile(file.nodeId) + this.ordered.push(file.nodeId) }, selectFile(nodeId) { this.selectedNodeId = nodeId ?? 0 @@ -213,6 +215,11 @@ export const useFilesStore = function(...args) { })) } del(this.files, file.nodeId) + + const index = this.ordered.indexOf(file.nodeId) + if (index > -1) { + this.ordered.splice(index, 1) + } }, async getAllFiles(filter) { if (!filter) filter = {} @@ -234,11 +241,15 @@ export const useFilesStore = function(...args) { } const response = await axios.get(generateOcsUrl('/apps/libresign/api/v1/file/list'), { params: filter }) this.files = {} + this.ordered = [] response.data.ocs.data.data.forEach(file => { this.addFile(file) }) return this.files }, + filesSorted() { + return this.ordered.map(key => this.files[key]) + }, filter(type) { this.filterActive = type if (type === 'pending') { diff --git a/src/views/FilesList/VirtualList.vue b/src/views/FilesList/VirtualList.vue index 1acf4fc1c..e3cc011d8 100644 --- a/src/views/FilesList/VirtualList.vue +++ b/src/views/FilesList/VirtualList.vue @@ -14,7 +14,7 @@ :class="userConfigStore.grid_view ? 'files-list__tbody--grid' : 'files-list__tbody--list'" data-cy-files-list-tbody>