import { PageActionType } from '@/config/types'; import { AlertBlockInfo, FormDrawer, ModalFooter } from '@gpustack/core-ui'; import { useIntl } from '@umijs/max'; import React, { useRef } from 'react'; import { FormData, RouteItem as ListItem } from '../config/types'; import ModelRouteForm from '../forms'; type AddModalProps = { title: string; action: PageActionType; realAction?: string; open: boolean; currentData?: ListItem; // Used when action is EDIT onOk: (values: FormData) => void; onCancel: () => void; }; const AddProvider: React.FC = ({ title, action, realAction, open, currentData, onOk, onCancel }) => { const intl = useIntl(); const [isChanged, setIsChanged] = React.useState(false); const form = useRef(null); const handleSubmit = () => { form.current?.submit(); }; const onFinish = async (data: FormData) => { onOk({ ...data }); }; const handleCancel = () => { form.current?.resetFields(); onCancel(); }; return ( {isChanged && ( )} } > { setIsChanged(changed); }} /> ); }; export default AddProvider;