Skip to content

Commit

Permalink
feat(dcellar-web-ui): add bucket status tip to the bucket detail draw…
Browse files Browse the repository at this point in the history
…er (#388)
  • Loading branch information
devinxl authored May 30, 2024
1 parent bca052c commit 0afb27d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) => (
<Text as={'div'} fontSize={'14px'} fontWeight={500} color="readable.tertiary">
Expand Down Expand Up @@ -101,6 +102,12 @@ export const DetailBucketOperation = memo<DetailBucketOperationProps>(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',
Expand Down Expand Up @@ -418,7 +425,7 @@ export const DetailBucketOperation = memo<DetailBucketOperationProps>(function D
<>
<QDrawerHeader>Bucket Detail</QDrawerHeader>
<QDrawerBody>
<Flex mb={24}>
<Flex mb={16}>
<IconFont type="detail-bucket" w={120} />
<Box marginLeft={'24px'} flex={1}>
<Text color="readable.tertiary" fontSize={'12px'} marginBottom="4px">
Expand Down Expand Up @@ -477,6 +484,27 @@ export const DetailBucketOperation = memo<DetailBucketOperationProps>(function D
</Text>
</Box>
</Flex>
{isFlowRateLimit && (
<DiscontinueBanner
marginBottom={16}
content="The bucket's flow rate exceeds the payment account limit."
/>
)}
{isBucketDiscontinue && (
<DiscontinueBanner
marginBottom={16}
content="All discontinued items in this bucket will be deleted by SP soon."
/>
)}
{isBucketMigrating && (
<DiscontinueBanner
icon={<IconFont w={16} type={'migrate'} color={'#1184EE'} />}
color={'#1184EE'}
bg="opacity7"
marginBottom={16}
content="This bucket is in the process of data migration to another provider."
/>
)}
<Tabs>
<TabList mb={24}>
{VERSION_TABS.map((tab) => (
Expand Down
5 changes: 4 additions & 1 deletion apps/dcellar-web-ui/src/store/slices/bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 0afb27d

Please sign in to comment.