Skip to content

Commit da215a8

Browse files
committed
feat(FR-1788): add more fields to User list page with BooleanTagWithFallBack component
1 parent 2bb0f34 commit da215a8

File tree

25 files changed

+308
-55
lines changed

25 files changed

+308
-55
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { Tag } from 'antd';
2+
import React from 'react';
3+
4+
const BooleanTagWithFallBack: React.FC<{
5+
value: boolean | null | undefined;
6+
fallback?: React.ReactNode;
7+
}> = ({ value, fallback = '-' }) => {
8+
if (typeof value !== 'boolean') {
9+
return fallback;
10+
}
11+
return value ? (
12+
<Tag color="warning">true</Tag>
13+
) : (
14+
<Tag
15+
style={{
16+
opacity: 0.5,
17+
}}
18+
>
19+
false
20+
</Tag>
21+
);
22+
};
23+
24+
export default BooleanTagWithFallBack;

packages/backend.ai-ui/src/components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export type { BAIConfirmModalWithInputProps } from './BAIConfirmModalWithInput';
5858
export { default as BAIButton } from './BAIButton';
5959
export type { BAIButtonProps } from './BAIButton';
6060
export { default as BAIFetchKeyButton } from './BAIFetchKeyButton';
61+
export { default as BooleanTagWithFallBack } from './BooleanTagWithFallBack';
6162
export * from './Table';
6263
export * from './fragments';
6364
export * from './provider';

0 commit comments

Comments
 (0)