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

Commit 17a3bb1

Browse files
committed
fix: Saved correlation apply bug fix
1 parent 497d32b commit 17a3bb1

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

src/pages/Correlation/components/CorrelationSideBar.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
import { TextInput, Text } from '@mantine/core';
2-
import { IconTrashX } from '@tabler/icons-react';
3-
import classes from '../styles/Correlation.module.css';
4-
import { CorrelationFieldItem } from './CorrelationFieldItem';
5-
import { StreamSelectBox } from './StreamSelectBox';
6-
import { correlationStoreReducers, useCorrelationStore } from '../providers/CorrelationProvider';
71
import { FC, useState } from 'react';
2+
import { Text, TextInput } from '@mantine/core';
83
import { appStoreReducers, useAppStore } from '@/layouts/MainLayout/providers/AppProvider';
4+
import { correlationStoreReducers, useCorrelationStore } from '../providers/CorrelationProvider';
5+
6+
import { CorrelationFieldItem } from './CorrelationFieldItem';
7+
import { IconTrashX } from '@tabler/icons-react';
8+
import { StreamSelectBox } from './StreamSelectBox';
9+
import classes from '../styles/Correlation.module.css';
910

10-
const { changeStream } = appStoreReducers;
11+
const { setStreamForCorrelation } = appStoreReducers;
1112
const { setIsCorrelatedFlag, setSelectedFields, deleteStreamData } = correlationStoreReducers;
1213

1314
interface CorrelationSideBarProps {
@@ -50,7 +51,7 @@ export const CorrelationSidebar: FC<CorrelationSideBarProps> = ({
5051
};
5152
const addStream = (value: string | null) => {
5253
if (value) {
53-
setAppStore((store) => changeStream(store, value));
54+
setAppStore((store) => setStreamForCorrelation(store, value));
5455
}
5556
};
5657

@@ -94,7 +95,7 @@ export const CorrelationSidebar: FC<CorrelationSideBarProps> = ({
9495
cursor="pointer"
9596
size={14}
9697
onClick={() => {
97-
setAppStore((store) => changeStream(store, ''));
98+
setAppStore((store) => setStreamForCorrelation(store, ''));
9899
setCorrelationData((store) => setIsCorrelatedFlag(store, false));
99100
setSelect1Value({ value: null, dataType: '' });
100101
setSelect2Value({ value: null, dataType: '' });

src/pages/Correlation/components/SavedCorrelationItem.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import classes from '../styles/SavedCorrelationItem.module.css';
99
import dayjs from 'dayjs';
1010
import { useCorrelationsQuery } from '@/hooks/useCorrelations';
1111

12-
const { toggleSavedCorrelationsModal, setCorrelationId, cleanCorrelationStore } = correlationStoreReducers;
12+
const { toggleSavedCorrelationsModal, setCorrelationId } = correlationStoreReducers;
1313

1414
const renderDeleteIcon = () => <IconTrash size={px('1rem')} stroke={1.5} />;
1515
const renderCloseIcon = () => <IconX size={px('1rem')} stroke={1.5} />;
@@ -106,7 +106,6 @@ const SavedCorrelationItem = (props: { item: Correlation }) => {
106106
}, []);
107107

108108
const onCorrelationAppy = useCallback(() => {
109-
setCorrelationData(cleanCorrelationStore);
110109
setCorrelationData((store) => setCorrelationId(store, id));
111110
closeModal();
112111
}, []);

src/pages/Correlation/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { useDocumentTitle } from '@mantine/hooks';
2727
import { useFetchStreamData } from '@/hooks/useFetchStreamData';
2828
import useParamsController from './hooks/useParamsController';
2929

30-
const { changeStream, setTimeRange } = appStoreReducers;
30+
const { setStreamForCorrelation, setTimeRange } = appStoreReducers;
3131
const { setSelectedFields, setCorrelationCondition, setActiveCorrelation, setPageAndPageData, setTargetPage } =
3232
correlationStoreReducers;
3333

@@ -173,7 +173,7 @@ const Correlation = () => {
173173
const updateCorrelationCondition = () => {
174174
if (select1Value.value && select2Value.value) {
175175
const condition = `"${streamNames[0]}".${select1Value.value} = "${streamNames[1]}".${select2Value.value}`;
176-
setAppStore((store) => changeStream(store, 'correlatedStream'));
176+
setAppStore((store) => setStreamForCorrelation(store, 'correlatedStream'));
177177
setCorrelationData((store) => setCorrelationCondition(store, condition));
178178
}
179179
};

0 commit comments

Comments
 (0)