Skip to content

Commit 152f4e1

Browse files
Merge branch 'main' into elizabet/compact-search-layout
2 parents c6a57c9 + 938494d commit 152f4e1

9 files changed

Lines changed: 86 additions & 85 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@hyperdx/app': patch
3+
---
4+
5+
feat: use the click-ui `Badge` in the metric explorer, the chart series and
6+
formula editors, the tile alert editor, the materialized view indicator and
7+
modal, and the span kind in the row side panel.

‎packages/app/src/components/DBEditTimeChartForm/ChartFormulaEditor.tsx‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import {
55
UseFormSetValue,
66
useWatch,
77
} from 'react-hook-form';
8+
import { Badge } from '@clickhouse/click-ui';
89
import { validateFormula } from '@hyperdx/common-utils/dist/core/formula';
9-
import { Badge, TextInput } from '@mantine/core';
10+
import { TextInput } from '@mantine/core';
1011
import { useDisclosure } from '@mantine/hooks';
1112

1213
import { ChartSeriesControls } from '@/components/ChartEditor/ChartSeriesControls';
@@ -81,11 +82,7 @@ export function ChartFormulaEditor({
8182
onSubmit={onSubmit}
8283
onRemove={onRemoveFormula}
8384
onOpenNumberFormat={openNumberFormat}
84-
leadingSection={
85-
<Badge size="sm" radius="sm" variant="light" color="teal">
86-
Formula
87-
</Badge>
88-
}
85+
leadingSection={<Badge size="sm" text="Formula" state="success" />}
8986
/>
9087
<Controller
9188
control={control}

‎packages/app/src/components/DBEditTimeChartForm/ChartSeriesEditor.tsx‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
UseFormSetValue,
77
useWatch,
88
} from 'react-hook-form';
9+
import { Badge } from '@clickhouse/click-ui';
910
import { indexToSeriesRef } from '@hyperdx/common-utils/dist/core/formula';
1011
import {
1112
DateRange,
@@ -14,7 +15,7 @@ import {
1415
SourceKind,
1516
TSource,
1617
} from '@hyperdx/common-utils/dist/types';
17-
import { ActionIcon, Badge, Flex, Group, Text, Tooltip } from '@mantine/core';
18+
import { ActionIcon, Flex, Group, Text, Tooltip } from '@mantine/core';
1819
import { useDisclosure } from '@mantine/hooks';
1920
import { IconListSearch, IconPalette } from '@tabler/icons-react';
2021

@@ -310,13 +311,10 @@ export function ChartSeriesEditor({
310311
<Tooltip label="Reference this series in a formula by this letter">
311312
<Badge
312313
size="sm"
313-
radius="sm"
314-
variant="light"
315-
color="gray"
314+
text={indexToSeriesRef(index) ?? index + 1}
315+
state="neutral"
316316
data-testid="series-ref-badge"
317-
>
318-
{indexToSeriesRef(index) ?? index + 1}
319-
</Badge>
317+
/>
320318
</Tooltip>
321319
) : undefined
322320
}

‎packages/app/src/components/DBEditTimeChartForm/TileAlertEditor.tsx‎

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
UseFormSetValue,
55
useWatch,
66
} from 'react-hook-form';
7+
import { Badge } from '@clickhouse/click-ui';
78
import { formatTileAlertDisplayName } from '@hyperdx/common-utils/dist/alerts';
89
import {
910
AlertThresholdType,
@@ -12,7 +13,6 @@ import {
1213
import {
1314
ActionIcon,
1415
Alert,
15-
Badge,
1616
Box,
1717
Group,
1818
NativeSelect,
@@ -134,20 +134,21 @@ export function TileAlertEditor({
134134
{error && (
135135
<Tooltip label={error} withArrow>
136136
<Badge
137-
color="var(--color-text-danger)"
138-
size="xs"
139-
variant="light"
140-
ml="xs"
141-
>
142-
Invalid Query
143-
</Badge>
137+
size="sm"
138+
text="Invalid query"
139+
state="danger"
140+
style={{ marginLeft: 'var(--mantine-spacing-xs)' }}
141+
/>
144142
</Tooltip>
145143
)}
146144
{warning && (
147145
<Tooltip label={warning} withArrow>
148-
<Badge color="yellow" size="xs" variant="light" ml="xs">
149-
Warning
150-
</Badge>
146+
<Badge
147+
size="sm"
148+
text="Warning"
149+
state="warning"
150+
style={{ marginLeft: 'var(--mantine-spacing-xs)' }}
151+
/>
151152
</Tooltip>
152153
)}
153154
</Group>

‎packages/app/src/components/DBRowSidePanel.tsx‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { isString } from 'lodash';
1212
import { ErrorBoundary, FallbackProps } from 'react-error-boundary';
1313
import { useHotkeys } from 'react-hotkeys-hook';
1414
import SqlString from 'sqlstring';
15+
import { Badge } from '@clickhouse/click-ui';
1516
import {
1617
isLogSource,
1718
isTraceSource,
@@ -23,7 +24,6 @@ import {
2324
import { BuilderChartConfigWithDateRange } from '@hyperdx/common-utils/dist/types';
2425
import {
2526
ActionIcon,
26-
Badge,
2727
Box,
2828
Button,
2929
CopyButton,
@@ -978,9 +978,7 @@ export const DBRowSidePanelInner = ({
978978
</>
979979
)}
980980
{sourceIsTrace && spanKindLabel && (
981-
<Badge size="sm" variant="light" radius="sm">
982-
{spanKindLabel}
983-
</Badge>
981+
<Badge size="sm" text={spanKindLabel} state="info" />
984982
)}
985983
{(sourceIsTrace ? traceId : showLogTraceActions) && (
986984
<>

‎packages/app/src/components/MaterializedViews/MVOptimizationIndicator.tsx‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { useState } from 'react';
2+
import { Badge } from '@clickhouse/click-ui';
23
import {
34
BuilderChartConfigWithOptDateRange,
45
SourceKind,
56
TSource,
67
} from '@hyperdx/common-utils/dist/types';
7-
import { ActionIcon, Badge, Tooltip } from '@mantine/core';
8+
import { ActionIcon, Tooltip } from '@mantine/core';
89
import { IconBolt, IconBoltOff } from '@tabler/icons-react';
910

1011
import { useMVOptimizationExplanation } from '@/hooks/useMVOptimizationExplanation';
@@ -22,10 +23,10 @@ function MVOptimizationIcon({
2223
onClick: () => void;
2324
}) {
2425
return isInWarningState ? (
25-
<Tooltip label="Not Accelerated">
26+
<Tooltip label="Not accelerated">
2627
<ActionIcon
2728
onClick={onClick}
28-
aria-label="Not Accelerated"
29+
aria-label="Not accelerated"
2930
data-testid="mv-optimization-indicator"
3031
data-mv-accelerated="false"
3132
>
@@ -55,14 +56,13 @@ function MVOptimizationBadge({
5556
}) {
5657
return (
5758
<Badge
58-
color={isInWarningState ? WARNING_COLOR : SUCCESS_COLOR}
59+
text={isInWarningState ? 'Not accelerated' : 'Accelerated'}
60+
state={isInWarningState ? 'warning' : 'success'}
5961
onClick={onClick}
6062
className="cursor-pointer"
6163
data-testid="mv-optimization-indicator"
6264
data-mv-accelerated={isInWarningState ? 'false' : 'true'}
63-
>
64-
{isInWarningState ? 'Not Accelerated' : 'Accelerated'}
65-
</Badge>
65+
/>
6666
);
6767
}
6868

‎packages/app/src/components/MaterializedViews/MVOptimizationModal.tsx‎

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
11
import { useMemo } from 'react';
2+
import { Badge } from '@clickhouse/click-ui';
23
import { MVOptimizationExplanation } from '@hyperdx/common-utils/dist/core/materializedViews';
34
import { MaterializedViewConfiguration } from '@hyperdx/common-utils/dist/types';
4-
import {
5-
Accordion,
6-
Alert,
7-
Badge,
8-
Group,
9-
Modal,
10-
Text,
11-
Tooltip,
12-
} from '@mantine/core';
5+
import { Accordion, Alert, Group, Modal, Text, Tooltip } from '@mantine/core';
136

147
import MVConfigSummary from './MVConfigSummary';
158

16-
const WARNING_COLOR = 'var(--color-bg-warning)';
17-
const SUCCESS_COLOR = 'var(--color-bg-success)';
18-
199
function mvConfigToKey(config: MaterializedViewConfiguration) {
2010
return `mv-${config.databaseName}-${config.tableName}`;
2111
}
@@ -75,35 +65,38 @@ export default function MVOptimizationModal({
7565
{isBeingUsedByOptimizedConfig ? (
7666
<Tooltip label={`Estimated rows scanned: ${rowEstimate}`}>
7767
<Badge
78-
me="md"
79-
color={SUCCESS_COLOR}
68+
text="Active"
69+
state="success"
70+
style={{
71+
marginInlineEnd: 'var(--mantine-spacing-md)',
72+
}}
8073
data-testid="mv-optimization-modal-status"
8174
data-mv-status="active"
82-
>
83-
Active
84-
</Badge>
75+
/>
8576
</Tooltip>
8677
) : hasErrors ? (
8778
<Tooltip label="This materialized view is not compatible with the selected query.">
8879
<Badge
89-
me="md"
90-
color={WARNING_COLOR}
80+
text="Incompatible"
81+
state="warning"
82+
style={{
83+
marginInlineEnd: 'var(--mantine-spacing-md)',
84+
}}
9185
data-testid="mv-optimization-modal-status"
9286
data-mv-status="incompatible"
93-
>
94-
Incompatible
95-
</Badge>
87+
/>
9688
</Tooltip>
9789
) : explanation ? (
9890
<Tooltip label={`Estimated rows scanned: ${rowEstimate}`}>
9991
<Badge
100-
me="md"
101-
color="gray"
92+
text="Skipped"
93+
state="neutral"
94+
style={{
95+
marginInlineEnd: 'var(--mantine-spacing-md)',
96+
}}
10297
data-testid="mv-optimization-modal-status"
10398
data-mv-status="skipped"
104-
>
105-
Skipped
106-
</Badge>
99+
/>
107100
</Tooltip>
108101
) : null}
109102
</Group>

‎packages/app/src/components/MetricAttributeHelperPanel.tsx‎

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useCallback, useMemo, useState } from 'react';
2+
import { Badge } from '@clickhouse/click-ui';
23
import { TMetricSource } from '@hyperdx/common-utils/dist/types';
34
import {
4-
Badge,
55
Box,
66
Button,
77
Collapse,
@@ -237,9 +237,11 @@ export function AttributeValueList({
237237
<Text size="sm" fw={500}>
238238
{attribute.name}
239239
</Text>
240-
<Badge size="xs" variant="default">
241-
{CATEGORY_LABELS[attribute.category]}
242-
</Badge>
240+
<Badge
241+
size="sm"
242+
text={CATEGORY_LABELS[attribute.category]}
243+
state="neutral"
244+
/>
243245
</Group>
244246
</UnstyledButton>
245247
{onAddToGroupBy && (
@@ -366,9 +368,7 @@ export function AttributeList({
366368
<Text size="xs" fw={600} c="dimmed">
367369
{CATEGORY_LABELS[category]}
368370
</Text>
369-
<Badge size="xs" variant="default">
370-
{attrs.length}
371-
</Badge>
371+
<Badge size="sm" text={attrs.length} state="neutral" />
372372
</Group>
373373
<Flex gap={6} wrap="wrap">
374374
{attrs.map(attr => (
@@ -447,22 +447,28 @@ export function MetricAttributeHelperPanel({
447447
<Text size="xs" c="dimmed">
448448
Unit:
449449
</Text>
450-
<Badge size="xs" variant="light">
451-
{formatUnitDisplay(metricMetadata.unit)}
452-
</Badge>
450+
<Badge
451+
size="sm"
452+
text={formatUnitDisplay(metricMetadata.unit)}
453+
state="info"
454+
/>
453455
</Group>
454456
)}
455457
</Box>
456458
<Group gap="xs" wrap="nowrap">
457459
{!!metricType && (
458-
<Badge size="xs" variant="light">
459-
{metricKindLabel(metricType)}
460-
</Badge>
460+
<Badge
461+
size="sm"
462+
text={metricKindLabel(metricType)}
463+
state="info"
464+
/>
461465
)}
462466
{attributeKeys.length > 0 && (
463-
<Badge size="xs" variant="light">
464-
{attributeKeys.length} attributes
465-
</Badge>
467+
<Badge
468+
size="sm"
469+
text={`${attributeKeys.length} attributes`}
470+
state="neutral"
471+
/>
466472
)}
467473
<IconChevronDown
468474
size={16}

‎packages/app/src/components/MetricExplorer/MetricDetailPanel.tsx‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useCallback, useMemo, useState } from 'react';
2+
import { Badge } from '@clickhouse/click-ui';
23
import { TMetricSource } from '@hyperdx/common-utils/dist/types';
34
import {
4-
Badge,
55
Box,
66
Divider,
77
Group,
@@ -116,9 +116,12 @@ function MetricDetail({
116116
<Text size="sm" fw={600} style={{ wordBreak: 'break-all' }}>
117117
{metricName}
118118
</Text>
119-
<Badge size="xs" variant="light" style={{ flexShrink: 0 }}>
120-
{METRIC_KIND_LABELS[metricType]}
121-
</Badge>
119+
<Badge
120+
size="sm"
121+
text={METRIC_KIND_LABELS[metricType]}
122+
state="info"
123+
style={{ flexShrink: 0 }}
124+
/>
122125
</Group>
123126

124127
<Stack gap={4} mt={4}>
@@ -159,9 +162,7 @@ function MetricDetail({
159162
Tags
160163
</Text>
161164
{attributeKeys.length > 0 && (
162-
<Badge size="xs" variant="default" fw="normal">
163-
{attributeKeys.length}
164-
</Badge>
165+
<Badge size="sm" text={attributeKeys.length} state="neutral" />
165166
)}
166167
</Group>
167168

0 commit comments

Comments
 (0)