mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-13 19:35:56 +08:00
fix: fix the issue of adding new query in new alert page changing the data source (#6286)
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
This commit is contained in:
parent
b64326070c
commit
939e2a3570
@ -53,6 +53,7 @@ import {
|
|||||||
QueryFunctionProps,
|
QueryFunctionProps,
|
||||||
} from 'types/api/queryBuilder/queryBuilderData';
|
} from 'types/api/queryBuilder/queryBuilderData';
|
||||||
import { EQueryType } from 'types/common/dashboard';
|
import { EQueryType } from 'types/common/dashboard';
|
||||||
|
import { DataSource } from 'types/common/queryBuilder';
|
||||||
import { GlobalReducer } from 'types/reducer/globalTime';
|
import { GlobalReducer } from 'types/reducer/globalTime';
|
||||||
|
|
||||||
import BasicInfo from './BasicInfo';
|
import BasicInfo from './BasicInfo';
|
||||||
@ -105,6 +106,11 @@ function FormAlertRules({
|
|||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const queryParams = new URLSearchParams(location.search);
|
const queryParams = new URLSearchParams(location.search);
|
||||||
|
|
||||||
|
const dataSource = useMemo(
|
||||||
|
() => urlQuery.get(QueryParams.alertType) as DataSource,
|
||||||
|
[urlQuery],
|
||||||
|
);
|
||||||
|
|
||||||
// In case of alert the panel types should always be "Graph" only
|
// In case of alert the panel types should always be "Graph" only
|
||||||
const panelType = PANEL_TYPES.TIME_SERIES;
|
const panelType = PANEL_TYPES.TIME_SERIES;
|
||||||
|
|
||||||
@ -114,13 +120,12 @@ function FormAlertRules({
|
|||||||
handleSetQueryData,
|
handleSetQueryData,
|
||||||
handleRunQuery,
|
handleRunQuery,
|
||||||
handleSetConfig,
|
handleSetConfig,
|
||||||
initialDataSource,
|
|
||||||
redirectWithQueryBuilderData,
|
redirectWithQueryBuilderData,
|
||||||
} = useQueryBuilder();
|
} = useQueryBuilder();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
handleSetConfig(panelType || PANEL_TYPES.TIME_SERIES, initialDataSource);
|
handleSetConfig(panelType || PANEL_TYPES.TIME_SERIES, dataSource);
|
||||||
}, [handleSetConfig, initialDataSource, panelType]);
|
}, [handleSetConfig, dataSource, panelType]);
|
||||||
|
|
||||||
// use query client
|
// use query client
|
||||||
const ruleCache = useQueryClient();
|
const ruleCache = useQueryClient();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user