From 555281e1e6ab924c5c70d09721e1dd337efbd626 Mon Sep 17 00:00:00 2001 From: devinxl Date: Thu, 11 Apr 2024 15:24:25 +0800 Subject: [PATCH] fix(dcellar-web-ui): refresh task folder error --- .../GlobalManagements/GlobalObjectUploadManager.tsx | 8 ++++---- apps/dcellar-web-ui/src/store/slices/object.ts | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/dcellar-web-ui/src/components/layout/GlobalManagements/GlobalObjectUploadManager.tsx b/apps/dcellar-web-ui/src/components/layout/GlobalManagements/GlobalObjectUploadManager.tsx index 41d42fd0..677454bc 100644 --- a/apps/dcellar-web-ui/src/components/layout/GlobalManagements/GlobalObjectUploadManager.tsx +++ b/apps/dcellar-web-ui/src/components/layout/GlobalManagements/GlobalObjectUploadManager.tsx @@ -170,10 +170,10 @@ export const GlobalObjectUploadManager = memo( axios .put(url, task.waitObject.file, { async onUploadProgress(progressEvent) { - const progress = Math.floor( - (progressEvent.loaded / (progressEvent.total as number)) * 100, - ); - await dispatch(progressFetchList(task)); + const progress = progressEvent.total + ? Math.floor((progressEvent.loaded / progressEvent.total) * 100) + : 0; + progress > 30 && (await dispatch(progressFetchList(task))); if (authModal) return; dispatch(updateUploadProgress({ account: loginAccount, id: task.id, progress })); }, diff --git a/apps/dcellar-web-ui/src/store/slices/object.ts b/apps/dcellar-web-ui/src/store/slices/object.ts index 6b2e252c..ec31d8ac 100644 --- a/apps/dcellar-web-ui/src/store/slices/object.ts +++ b/apps/dcellar-web-ui/src/store/slices/object.ts @@ -486,8 +486,9 @@ export const setupListObjects = const _query = new URLSearchParams(params.query?.toString() || ''); _query.append('max-keys', '1000'); _query.append('delimiter', '/'); + const commonPrefix = _completeCommonPrefix - ? _completeCommonPrefix.split('/').slice(1).join('/') + ? _completeCommonPrefix.split('/').slice(1).join('/') + '/' : objectCommonPrefix; if (commonPrefix) _query.append('prefix', commonPrefix); // support any path list objects, bucketName & _path