{intl.formatMessage({ diff --git a/ui/src/components/customModal/AddNSModal.tsx b/ui/src/components/customModal/AddNSModal.tsx index c9e07d094..ce65d626f 100644 --- a/ui/src/components/customModal/AddNSModal.tsx +++ b/ui/src/components/customModal/AddNSModal.tsx @@ -39,7 +39,7 @@ export default function AddNSModal({ form.submit(); } catch (err) {} }; - const handleCancel = () => setVisible(false); + const onCancel = () => setVisible(false); const onFinish = async (val: FormData) => { newNamespace.current = val.namespace; await createNS(val.namespace); @@ -50,9 +50,9 @@ export default function AddNSModal({ id: 'OBDashboard.components.customModal.AddNSModal.AddNamespace', defaultMessage: '新增命名空间', })} - isOpen={visible} - handleOk={handleSubmit} - handleCancel={handleCancel} + open={visible} + onOk={handleSubmit} + onCancel={onCancel} >
{intl.formatMessage({ diff --git a/ui/src/components/customModal/UpgradeModal.tsx b/ui/src/components/customModal/UpgradeModal.tsx index fe191b71f..d5a01e443 100644 --- a/ui/src/components/customModal/UpgradeModal.tsx +++ b/ui/src/components/customModal/UpgradeModal.tsx @@ -23,7 +23,7 @@ export default function UpgradeModal({ } catch (err) {} }; - const handleCancel = () => setVisible(false); + const onCancel = () => setVisible(false); const onFinish = async ({ image }: any) => { const res = await upgradeClusterReportWrap({ ns, name, image }); if (res.successful) { @@ -45,9 +45,9 @@ export default function UpgradeModal({ id: 'OBDashboard.components.customModal.UpgradeModal.VersionUpgrade', defaultMessage: '版本升级', })} - isOpen={visible} - handleOk={handleSubmit} - handleCancel={handleCancel} + open={visible} + onOk={handleSubmit} + onCancel={onCancel} >
{intl.formatMessage({
diff --git a/ui/src/components/customModal/index.tsx b/ui/src/components/customModal/index.tsx
index 6c9e8893b..83e5bf162 100644
--- a/ui/src/components/customModal/index.tsx
+++ b/ui/src/components/customModal/index.tsx
@@ -1,37 +1,30 @@
import { intl } from '@/utils/intl';
-import { Modal } from 'antd';
-import { ReactNode } from 'react';
+import { Modal, ModalProps } from 'antd';
-interface CustomModalProps {
- isOpen: boolean;
- title?: string;
- handleOk?: () => void;
- handleCancel?: () => void;
- children: ReactNode;
- footer?: React.ReactNode;
- width?: number;
-}
-
-export default function CustomModal(props: CustomModalProps) {
- const { isOpen, handleOk, handleCancel, title, width = 520, footer } = props;
+/**
+ * By default, you are not allowed to click on the mask to close the pop-up window.
+ */
+export default function CustomModal({
+ width = 520,
+ children,
+ maskClosable = false,
+ ...props
+}: ModalProps) {
return (