Skip to content

Commit afcff3c

Browse files
authored
feat(indexes): show tooltip for rolling index build status COMPASS-9129 (#6799)
feat(indexes): show tooltip for rolling index build status
1 parent 837784b commit afcff3c

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

packages/compass-indexes/src/components/regular-indexes-table/status-field.tsx

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,26 @@ const statusFieldStyles = css({
1818
alignItems: 'baseline',
1919
});
2020

21-
const iconBadgeStyles = css({
22-
gap: spacing[200],
23-
});
24-
25-
const ErrorBadgeWithTooltip: React.FunctionComponent<{
21+
const BadgeWithTooltip: React.FunctionComponent<{
2622
['data-testid']?: string;
27-
text: string;
2823
tooltip?: string | null;
2924
darkMode?: boolean;
30-
}> = ({ ['data-testid']: dataTestId, text, tooltip, darkMode }) => {
25+
variant?: BadgeVariant;
26+
children: React.ReactNode;
27+
}> = ({
28+
['data-testid']: dataTestId,
29+
children,
30+
tooltip,
31+
darkMode,
32+
variant,
33+
}) => {
3134
return (
3235
<Tooltip
3336
enabled={!!tooltip}
3437
darkMode={darkMode}
3538
trigger={
36-
<Badge data-testid={dataTestId} variant={BadgeVariant.Red}>
37-
{text}
39+
<Badge data-testid={dataTestId} variant={variant}>
40+
{children}
3841
</Badge>
3942
}
4043
>
@@ -63,13 +66,13 @@ const StatusField: React.FunctionComponent<StatusFieldProps> = ({
6366
)}
6467

6568
{status === 'building' && (
66-
<Badge
69+
<BadgeWithTooltip
6770
data-testid="index-building"
6871
variant={BadgeVariant.Blue}
69-
className={iconBadgeStyles}
72+
tooltip="This index is being built in a rolling process"
7073
>
7174
Building
72-
</Badge>
75+
</BadgeWithTooltip>
7376
)}
7477

7578
{status === 'inprogress' && (
@@ -79,12 +82,14 @@ const StatusField: React.FunctionComponent<StatusFieldProps> = ({
7982
)}
8083

8184
{status === 'failed' && (
82-
<ErrorBadgeWithTooltip
85+
<BadgeWithTooltip
8386
data-testid="index-failed"
84-
text="Failed"
8587
tooltip={error ? error : ''}
8688
darkMode={darkMode}
87-
/>
89+
variant={BadgeVariant.Red}
90+
>
91+
Failed
92+
</BadgeWithTooltip>
8893
)}
8994
</div>
9095
);

0 commit comments

Comments
 (0)