import ModalFooter from '@/components/modal-footer'; import ScrollerModal from '@/components/scroller-modal/index'; import { PageActionType } from '@/config/types'; import React, { useRef } from 'react'; import { ProviderType } from '../config'; import { ClusterFormData as FormData, ClusterListItem as ListItem } from '../config/types'; import ClusterForm from './cluster-form'; type AddModalProps = { title: string; action: PageActionType; open: boolean; currentData?: ListItem; // Used when action is EDIT provider: ProviderType; credentialList: Global.BaseOption[]; onOk: (values: FormData) => void; onCancel: () => void; }; const AddCluster: React.FC = ({ title, action, open, provider, currentData, credentialList, onOk, onCancel }) => { const form = useRef(null); const handleSubmit = () => { form.current?.submit(); }; const handleOk = async (data: FormData) => { onOk({ ...data, provider }); }; const handleCancel = () => { form.current?.resetFields(); onCancel(); }; return ( } > ); }; export default AddCluster;