Skip to content
This repository was archived by the owner on May 13, 2025. It is now read-only.

Commit 0289aba

Browse files
committed
Added data type to join dropdown
1 parent b6be5e7 commit 0289aba

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

src/pages/Correlation/components/CorrelationFieldItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { Text, Tooltip } from '@mantine/core';
1010
import classes from '../styles/Correlation.module.css';
1111
import { useRef } from 'react';
1212

13-
const dataTypeIcons = (iconColor: string): Record<string, JSX.Element> => ({
13+
export const dataTypeIcons = (iconColor: string): Record<string, JSX.Element> => ({
1414
text: <IconLetterASmall size={16} style={{ color: iconColor }} />,
1515
timestamp: <IconClockHour5 size={16} style={{ color: iconColor }} />,
1616
number: <IconNumber123 size={16} style={{ color: iconColor }} />,

src/pages/Correlation/index.tsx

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useCallback, useEffect, useState } from 'react';
22
import { useDocumentTitle } from '@mantine/hooks';
3-
import { Stack, Box, TextInput, Text, Select, Button, Center, Stepper, Badge } from '@mantine/core';
3+
import { Stack, Box, TextInput, Text, Select, Button, Center, Stepper, Badge, SelectProps, Group } from '@mantine/core';
44
import { IconTrashX, IconX } from '@tabler/icons-react';
55
import {
66
PRIMARY_HEADER_HEIGHT,
@@ -22,7 +22,7 @@ import RefreshNow from '@/components/Header/RefreshNow';
2222
import MultiEventTimeLineGraph from './components/MultiEventTimeLineGraph';
2323
import { CorrelationEmptyPlaceholder } from './components/CorrelationEmptyPlaceholder';
2424
import { StreamSelectBox } from './components/StreamSelectBox';
25-
import { CorrelationFieldItem } from './components/CorrelationFieldItem';
25+
import { CorrelationFieldItem, dataTypeIcons } from './components/CorrelationFieldItem';
2626
import { MaximizeButton } from '../Stream/components/PrimaryToolbar';
2727
import ShareButton from './components/ShareButton';
2828
import useParamsController from './hooks/useParamsController';
@@ -231,6 +231,26 @@ const Correlation = () => {
231231
setCorrelationData((store) => toggleSaveCorrelationModal(store, true));
232232
}, []);
233233

234+
const renderJoinOneOptions: SelectProps['renderOption'] = ({ option }) => {
235+
const fieldType = fields[streamNames[0]]?.fieldTypeMap[option.value];
236+
return (
237+
<div style={{ display: 'flex', justifyContent: 'space-between', width: '100%' }}>
238+
{option.label}
239+
{dataTypeIcons('black')[fieldType]}
240+
</div>
241+
);
242+
};
243+
244+
const renderJoinTwoOptions: SelectProps['renderOption'] = ({ option }) => {
245+
const fieldType = fields[streamNames[1]]?.fieldTypeMap[option.value];
246+
return (
247+
<div style={{ display: 'flex', justifyContent: 'space-between', width: '100%' }}>
248+
{option.label}
249+
{dataTypeIcons('black')[fieldType]}
250+
</div>
251+
);
252+
};
253+
234254
// View Flags
235255
const hasContentLoaded = !schemaLoading && !loadingState && !streamsLoading && !multipleSchemasLoading;
236256
const hasNoData = hasContentLoaded && !errorMessage && pageData.length === 0;
@@ -442,6 +462,7 @@ const Correlation = () => {
442462
}
443463
value={select1Value}
444464
onChange={(value) => handleFieldChange(value, true)}
465+
renderOption={renderJoinOneOptions}
445466
/>
446467
</div>
447468
<Text size="md"> = </Text>
@@ -462,6 +483,7 @@ const Correlation = () => {
462483
}
463484
value={select2Value}
464485
onChange={(value) => handleFieldChange(value, false)}
486+
renderOption={renderJoinTwoOptions}
465487
/>
466488
</div>
467489
<div style={{ height: '100%', width: '20%', display: 'flex' }}>

0 commit comments

Comments
 (0)