import { Select, Typography } from 'antd'; import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder'; import { useMemo } from 'react'; import { useCreateAlertState } from '../context'; import { ANOMALY_ALGORITHM_OPTIONS, ANOMALY_SEASONALITY_OPTIONS, ANOMALY_THRESHOLD_MATCH_TYPE_OPTIONS, ANOMALY_THRESHOLD_OPERATOR_OPTIONS, ANOMALY_TIME_DURATION_OPTIONS, } from '../context/constants'; import { getQueryNames } from './utils'; function AnomalyThreshold(): JSX.Element { const { thresholdState, setThresholdState } = useCreateAlertState(); const { currentQuery } = useQueryBuilder(); const queryNames = getQueryNames(currentQuery); const deviationOptions = useMemo(() => { const options = []; for (let i = 1; i <= 7; i++) { options.push({ label: i.toString(), value: i }); } return options; }, []); const updateThreshold = (id: string, field: string, value: string): void => { setThresholdState({ type: 'SET_THRESHOLDS', payload: thresholdState.thresholds.map((t) => t.id === id ? { ...t, [field]: value } : t, ), }); }; return (
{/* Sentence 1 */}
Send notification when the observed value for { setThresholdState({ type: 'SET_EVALUATION_WINDOW', payload: value, }); }} style={{ width: 80 }} options={ANOMALY_TIME_DURATION_OPTIONS} />
{/* Sentence 2 */}
is { setThresholdState({ type: 'SET_OPERATOR', payload: value, }); }} style={{ width: 80 }} options={ANOMALY_THRESHOLD_OPERATOR_OPTIONS} /> the predicted data { setThresholdState({ type: 'SET_ALGORITHM', payload: value, }); }} style={{ width: 80 }} options={ANOMALY_ALGORITHM_OPTIONS} /> algorithm with