From 5ad82a3e0ec73693af493ce79a5bc853fbeb6f88 Mon Sep 17 00:00:00 2001 From: Csaky Date: Fri, 5 Apr 2024 13:41:59 -0700 Subject: [PATCH] Show file upload status Catch COMS error and show toast at component level Simplify fileUpload template --- .github/CODEOWNERS | 2 +- .../src/components/object/ObjectUpload.vue | 26 ++++++++----------- frontend/src/store/objectStore.ts | 25 +++++------------- frontend/tests/unit/store/objectStore.spec.ts | 1 - 4 files changed, 19 insertions(+), 35 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 5905bfbf..e0d26591 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,4 +1,4 @@ # These users will be the default owners for everything in the repo. # Unless a later match takes precedence, the following users will be # requested for review when someone opens a pull request. -* @jujaga @kyle1morel @TimCsaky @wilwong89 @jatindersingh93 @norrisng-bc +* @kyle1morel @TimCsaky @wilwong89 @jatindersingh93 @norrisng-bc diff --git a/frontend/src/components/object/ObjectUpload.vue b/frontend/src/components/object/ObjectUpload.vue index d9ac65be..2cbdc234 100644 --- a/frontend/src/components/object/ObjectUpload.vue +++ b/frontend/src/components/object/ObjectUpload.vue @@ -63,10 +63,16 @@ const onUpload = async (event: any) => { ); successfulFiles.value.push(file); } catch (error: any) { - toast.error(`Failed to upload file ${file.name}`, error); + // show toasts + if (error?.response?.status === 409) { + toast.error(`Failed to upload file ${file.name}`, 'File already exists'); + } else { + toast.error(`Failed to upload file ${file.name}`, error); + } failedFiles.value.push(file); } finally { appStore.endUploading(); + appStore.endIndeterminateLoading(); } }) ); @@ -156,18 +162,8 @@ const submitObjectMetaTagConfig = (values: Array) => />

Drag and drop files here to select for upload. Then click "Start upload".

- - -