From 68f2450c93d553ecc3035496662e9418095e9587 Mon Sep 17 00:00:00 2001 From: wvffle Date: Wed, 3 Aug 2022 12:42:03 +0000 Subject: [PATCH] Migrate FileUpload component and fix uploading files --- front/.eslintrc.js | 1 + front/src/components/channels/UploadForm.vue | 6 +- front/src/components/common/ActionTable.vue | 361 +++++----- front/src/components/library/FileUpload.vue | 636 +++++++++--------- .../components/library/FileUploadWidget.vue | 36 +- front/src/composables/useWebSocketHandler.ts | 56 +- front/src/init/webSocket.ts | 12 +- front/src/store/ui.ts | 2 +- front/src/types.ts | 45 +- front/src/views/Notifications.vue | 4 +- 10 files changed, 597 insertions(+), 562 deletions(-) diff --git a/front/.eslintrc.js b/front/.eslintrc.js index a378f0221..bc89c8201 100644 --- a/front/.eslintrc.js +++ b/front/.eslintrc.js @@ -28,6 +28,7 @@ module.exports = { // NOTE: Handled by typescript 'no-undef': 'off', + 'no-redeclare': 'off', 'no-unused-vars': 'off', 'no-use-before-define': 'off', diff --git a/front/src/components/channels/UploadForm.vue b/front/src/components/channels/UploadForm.vue index 6b5bbb055..c2d681318 100644 --- a/front/src/components/channels/UploadForm.vue +++ b/front/src/components/channels/UploadForm.vue @@ -105,7 +105,7 @@ const uploadedSize = computed(() => { for (const file of uploadedFiles.value) { if (file._fileObj && !file.error) { - uploaded += (file.size ?? 0) * +(file.progress ?? 0) + uploaded += (file.size ?? 0) * +(file.progress ?? 0) / 100 } } @@ -191,7 +191,7 @@ const uploadedFiles = computed(() => { response: upload, __filename: null, size: upload.size, - progress: '1.00', + progress: '100.00', name: upload.source?.replace('upload://', '') ?? '', active: false, removed: removed.has(upload.uuid), @@ -561,7 +561,7 @@ const labels = computed(() => ({ Pending · {{ humanSize(file.size ?? 0) }} - · {{ parseFloat(file.progress ?? '0') * 100 }}% + · {{ parseFloat(file.progress ?? '0') }}% · Remove diff --git a/front/src/components/common/ActionTable.vue b/front/src/components/common/ActionTable.vue index a7b7d1d3d..68b7948d2 100644 --- a/front/src/components/common/ActionTable.vue +++ b/front/src/components/common/ActionTable.vue @@ -1,3 +1,161 @@ + +