From 0afb27dfc55ca827b4259f391f89b3fd1cca8c32 Mon Sep 17 00:00:00 2001 From: devinxl <94832688+devinxl@users.noreply.github.com> Date: Thu, 30 May 2024 17:01:48 +0800 Subject: [PATCH] feat(dcellar-web-ui): add bucket status tip to the bucket detail drawer (#388) --- .../components/DetailBucketOperation.tsx | 30 ++++++++++++++++++- .../dcellar-web-ui/src/store/slices/bucket.ts | 5 +++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/apps/dcellar-web-ui/src/modules/bucket/components/DetailBucketOperation.tsx b/apps/dcellar-web-ui/src/modules/bucket/components/DetailBucketOperation.tsx index 63cf8687..fe01c558 100644 --- a/apps/dcellar-web-ui/src/modules/bucket/components/DetailBucketOperation.tsx +++ b/apps/dcellar-web-ui/src/modules/bucket/components/DetailBucketOperation.tsx @@ -44,6 +44,7 @@ import { useMount, useUnmount } from 'ahooks'; import { DEFAULT_TAG } from '@/components/common/ManageTags'; import { Activities } from '@/components/Activities'; import { BucketStatus } from '@bnb-chain/greenfield-js-sdk'; +import { DiscontinueBanner } from '@/components/common/DiscontinueBanner'; export const Label = ({ children }: PropsWithChildren) => ( @@ -101,6 +102,12 @@ export const DetailBucketOperation = memo(function D }, }; + const isFlowRateLimit = ['1', '3'].includes(selectedBucketInfo?.OffChainStatus); + const isBucketDiscontinue = + selectedBucketInfo.BucketStatus === BucketStatus.BUCKET_STATUS_DISCONTINUED; + const isBucketMigrating = + selectedBucketInfo.BucketStatus === BucketStatus.BUCKET_STATUS_MIGRATING; + const quotaDetail = [ { key: 'Monthly quota', @@ -418,7 +425,7 @@ export const DetailBucketOperation = memo(function D <> Bucket Detail - + @@ -477,6 +484,27 @@ export const DetailBucketOperation = memo(function D + {isFlowRateLimit && ( + + )} + {isBucketDiscontinue && ( + + )} + {isBucketMigrating && ( + } + color={'#1184EE'} + bg="opacity7" + marginBottom={16} + content="This bucket is in the process of data migration to another provider." + /> + )} {VERSION_TABS.map((tab) => ( diff --git a/apps/dcellar-web-ui/src/store/slices/bucket.ts b/apps/dcellar-web-ui/src/store/slices/bucket.ts index 6a7f66ff..79bb7531 100644 --- a/apps/dcellar-web-ui/src/store/slices/bucket.ts +++ b/apps/dcellar-web-ui/src/store/slices/bucket.ts @@ -243,7 +243,10 @@ export const setupBucketList = } const bucketList = - res.body?.map((bucket) => ({ ...bucket, BucketInfo: { ...bucket.BucketInfo } })) || []; + res.body?.map((bucket) => ({ + ...bucket, + BucketInfo: { ...bucket.BucketInfo, BucketStatus: 1 }, + })) || []; const bucketSpInfo = bucketList.map((b) => ({ bucketName: b.BucketInfo.BucketName,