diff --git a/frontend/src/store/getters.js b/frontend/src/store/getters.js index ebcfa0cf..2343128b 100644 --- a/frontend/src/store/getters.js +++ b/frontend/src/store/getters.js @@ -13,6 +13,13 @@ const getters = { let sum = state.upload.progress.reduce((acc, val) => acc + val); return Math.ceil((sum / totalSize) * 100); }, + filesInUploadCount: (state) => { + console.log("uploads", Object.keys(state.upload.uploads)); + console.log("queue", state.upload.queue); + console.log(Object.keys(state.upload.uploads).length + state.upload.queue.length); + let total = Object.keys(state.upload.uploads).length + state.upload.queue.length; + return total; + }, filesInUpload: (state) => { let files = []; diff --git a/frontend/src/store/modules/upload.js b/frontend/src/store/modules/upload.js index b5137e74..d703888e 100644 --- a/frontend/src/store/modules/upload.js +++ b/frontend/src/store/modules/upload.js @@ -33,6 +33,7 @@ const mutations = { Vue.set(state.uploads, item.id, item); }, removeJob(state, id) { + Vue.delete(state.uploads, id); delete state.uploads[id]; }, }; @@ -96,9 +97,7 @@ const actions = { { leading: true, trailing: false } ); - await api - .post(item.path, item.file, item.overwrite, onUpload) - .catch(Vue.prototype.$showError); + await api.post(item.path, item.file, item.overwrite, onUpload).catch(Vue.prototype.$showError); } context.dispatch("finishUpload", item); diff --git a/frontend/src/views/files/Listing.vue b/frontend/src/views/files/Listing.vue index b83bdabd..9f7027aa 100644 --- a/frontend/src/views/files/Listing.vue +++ b/frontend/src/views/files/Listing.vue @@ -21,7 +21,7 @@ icon="file_upload" id="upload-button" :label="$t('buttons.upload')" - :counter="filesInUpload.length" + :counter="filesInUploadCount" @action="upload" /> @@ -182,7 +182,7 @@ export default { }, computed: { ...mapState(["req", "selected", "user", "show", "multiple", "selected", "loading"]), - ...mapGetters(["selectedCount", "filesInUpload"]), + ...mapGetters(["selectedCount", "filesInUploadCount"]), nameSorted() { return this.req.sorting.by === "name"; }, @@ -701,7 +701,7 @@ export default { this.fillWindow(); }, upload: function () { - if (this.filesInUpload.length > 0) { + if (this.filesInUploadCount > 0) { this.$store.commit("showHover", "uploadFiles"); } else { if (typeof window.DataTransferItem !== "undefined" && typeof DataTransferItem.prototype.webkitGetAsEntry !== "undefined") {