Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show correct file upload status #185

Merged
merged 2 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -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
20 changes: 5 additions & 15 deletions frontend/src/components/object/ObjectUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const onUpload = async (event: any) => {
);
successfulFiles.value.push(file);
} catch (error: any) {
toast.error(`Failed to upload file ${file.name}`, error);
toast.error(`Failed to upload file ${file.name}`, error, {life: 0});
failedFiles.value.push(file);
} finally {
appStore.endUploading();
Expand Down Expand Up @@ -156,18 +156,8 @@ const submitObjectMetaTagConfig = (values: Array<ObjectMetadataTagFormType>) =>
/>
<p class="mt-4 mb-0">Drag and drop files here to select for upload. Then click "Start upload".</p>
</div>
<ObjectUploadFile
:files="successfulFiles"
:badge-props="{ value: 'Complete', severity: 'success' }"
:remove-callback="onRemoveUploadedFile"
/>
<ObjectUploadFile
:files="failedFiles"
:badge-props="{ value: 'Failed', severity: 'danger' }"
:remove-callback="onRemoveFailedFile"
/>
</template>
<template #content="{ files, uploadedFiles, removeFileCallback, removeUploadedFileCallback }">
<template #content="{ files, removeFileCallback }">
<ObjectUploadFile
:editable="true"
:files="files || pendingFiles"
Expand All @@ -177,14 +167,14 @@ const submitObjectMetaTagConfig = (values: Array<ObjectMetadataTagFormType>) =>
@submit-object-metadatatag-config="submitObjectMetaTagConfig"
/>
<ObjectUploadFile
:files="uploadedFiles || successfulFiles"
:files="successfulFiles"
:badge-props="{ value: 'Complete', severity: 'success' }"
:remove-callback="removeUploadedFileCallback"
:remove-callback="onRemoveUploadedFile"
/>
<ObjectUploadFile
:files="failedFiles"
:badge-props="{ value: 'Failed', severity: 'danger' }"
:remove-callback="removeUploadedFileCallback"
:remove-callback="onRemoveFailedFile"
/>
</template>
</FileUpload>
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/store/objectStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const useObjectStore = defineStore('object', () => {
},
axiosOptions?: AxiosRequestConfig
) {
try {
try{
appStore.beginIndeterminateLoading();

// Ensure x-amz-meta- prefix exists
Expand All @@ -64,11 +64,11 @@ export const useObjectStore = defineStore('object', () => {
}

await objectService.createObject(object, headers, params, axiosOptions);
} catch (error: any) {
if (error?.response?.status === 409) {
toast.error('Creating object', 'File already exists');
} catch(error: any) {
if (error.response?.status === 409){
throw new Error(error.response.data.detail);
} else {
toast.error('Creating object', error);
throw new Error('Network error');
}
} finally {
appStore.endIndeterminateLoading();
Expand Down
Loading