Professional Documents
Culture Documents
useCallback,
useEffect,
useMemo,
useRef,
useState,
} from 'react';
import { useNavigate } from 'react-router-dom';
import { useDispatch } from 'react-redux';
import {
Paper,
Stack,
Typography,
Button,
TextField,
Box,
} from '@mui/material';
import {
// dateIsValid as isValidDate,
validateDateRangeFilter,
} from 'utils/validations';
interface IOverviewProps {
modelType: ModelType;
text?: string | React.ReactNode;
}
if (res?.data?.[graphLabel]?.data)
res?.data?.[graphLabel]?.data?.graph?.data_points?.forEach(
(data: any) => {
Object.keys(data).forEach(key => {
if (key !== 'date') {
dataKey.add(key);
}
});
}
);
useEffect(() => {
if (getAppId && modelType) {
experimentsGridAPI.request({
params: {
path: modelsApis.GET_EXPERIMENT_DETAILS,
method: 'POST',
},
data: {
payload: {
app_id: getAppId,
model_type: modelType.toUpperCase(),
// ...postData,
},
},
});
}
}, []);
const graphCall = useCallback(Debounce(handleOverviewGraphApiCall, 500), []);
const graphPayload = {
// filters: [],
start_date: startDate,
end_date: endDate,
app_id: getAppId,
clickstream: clickStreamEnabled,
pagination: {
page: state.page,
page_size: state.page_size,
},
// filters:
// state.selectedMetrics?.length > 0
// ? [{ y_field: state.selectedMetrics.map((item: any) => item) }]
// : [
// {
// y_field: [],
// },
// ],
};
useEffect(() => {
if (selectedDateRange === 'custom') {
graphCall(graphPayload);
} else {
handleOverviewGraphApiCall(graphPayload);
}
}, [selectedCustomDateRange, selectedDateRange]);
selectedDateRangeRef.current = selectedDateRange;
selectedCustomDateRangeRef.current = selectedCustomDateRange;
// return filteredItem;
// });