From 8c4148c358b755a8d281e45ba54e4013c7c0278e Mon Sep 17 00:00:00 2001 From: RXRD <118821868+RiXelanya@users.noreply.github.com> Date: Tue, 9 Jan 2024 14:32:24 +0700 Subject: [PATCH] fix: add chunks progress in download dialog (#940) fix dialog --- src/common/components/Dialog/DownloadingDialog.vue | 5 ++++- .../Dashboard/Customer/Home/MyTest/TestResult.vue | 14 +++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/common/components/Dialog/DownloadingDialog.vue b/src/common/components/Dialog/DownloadingDialog.vue index ba41b8c7..ca1d8370 100644 --- a/src/common/components/Dialog/DownloadingDialog.vue +++ b/src/common/components/Dialog/DownloadingDialog.vue @@ -6,6 +6,7 @@ v-card-text .dialog-uploading__title Download in progress... + .dialog-uploading__title {{ chunks }} of {{ totalChunks }} chunks .dialog-uploading__card-loading SpinnerLoader( @@ -35,7 +36,9 @@ export default { }, props: { - show: Boolean + show: Boolean, + chunks: Number, + totalChunks: Number } } diff --git a/src/views/Dashboard/Customer/Home/MyTest/TestResult.vue b/src/views/Dashboard/Customer/Home/MyTest/TestResult.vue index f5c54201..13e76846 100644 --- a/src/views/Dashboard/Customer/Home/MyTest/TestResult.vue +++ b/src/views/Dashboard/Customer/Home/MyTest/TestResult.vue @@ -98,6 +98,8 @@ v-container ) DownloadingDialog( :show="resultLoading" + :chunks="chunks" + :totalChunks="totalChunks" ) @@ -149,7 +151,9 @@ export default { resultLoading: false, showModal: false, showModalRating: false, - files: [] + files: [], + chunks:0, + totalChunks:0 }), computed: { @@ -284,6 +288,7 @@ export default { if (/^\[/.test(path)) { const links = JSON.parse(path); + this.totalChunks = links.length for (let i = 0; i < links.length; i++) { const { rows } = await getIpfsMetaData(links[i].split("/").pop()) const { type, data } = await downloadFile(links[i], true) @@ -292,9 +297,12 @@ export default { fileType = type if (i === 0) { name = rows - } + } + this.chunks +=1 ; } - await downloadDocumentFile(fileChunks, name[0].metadata.name, fileType, true) + + await downloadDocumentFile(fileChunks, name[0].metadata.name, fileType, true); + this.chunks = 0; } else {