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

feat(dcellar-web-ui): add bucket status tip to the bucket detail drawer #388

Merged
merged 1 commit into from
May 30, 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
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
Loading