From b40bf76270851baaf75d2c861352b772a2199024 Mon Sep 17 00:00:00 2001 From: jialin Date: Thu, 19 Dec 2024 19:40:56 +0800 Subject: [PATCH] chore: the text on the recreate button --- src/components/delete-modal/index.tsx | 24 ++++++++++++++++---- src/locales/en-US/common.ts | 1 + src/locales/zh-CN/common.ts | 1 + src/pages/llmodels/components/table-list.tsx | 1 + 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/components/delete-modal/index.tsx b/src/components/delete-modal/index.tsx index 1f2c7d15..0996032f 100644 --- a/src/components/delete-modal/index.tsx +++ b/src/components/delete-modal/index.tsx @@ -8,7 +8,14 @@ const DeleteModal = forwardRef((props, ref) => { const intl = useIntl(); const [visible, setVisible] = useState(false); const [config, setConfig] = useState< - ModalFuncProps & { content: string; selection?: boolean; name?: string } + ModalFuncProps & { + content: string; + selection?: boolean; + name?: string; + okText?: string; + cancelText?: string; + title?: string; + } >({}); useImperativeHandle(ref, () => ({ @@ -17,6 +24,9 @@ const DeleteModal = forwardRef((props, ref) => { content: string; selection?: boolean; name?: string; + title?: string; + cancelText?: string; + okText?: string; } ) => { setConfig(data); @@ -55,10 +65,14 @@ const DeleteModal = forwardRef((props, ref) => { footer={ } @@ -67,7 +81,9 @@ const DeleteModal = forwardRef((props, ref) => { - {intl.formatMessage({ id: 'common.title.delete.confirm' })} + {config.title + ? intl.formatMessage({ id: config.title }) + : intl.formatMessage({ id: 'common.title.delete.confirm' })} diff --git a/src/locales/en-US/common.ts b/src/locales/en-US/common.ts index 9472c281..7605ffbc 100644 --- a/src/locales/en-US/common.ts +++ b/src/locales/en-US/common.ts @@ -204,6 +204,7 @@ export default { 'common.button.docs': 'Documentation', 'common.button.version': 'Version', 'common.title.delete.confirm': 'Confirm delete', + 'common.title.recreate.confirm': 'Confirm recreate', 'common.button.addLabel': 'Add Labels', 'common.button.addSelector': 'Add Selectors', 'common.button.addParams': 'Add Parameter', diff --git a/src/locales/zh-CN/common.ts b/src/locales/zh-CN/common.ts index a65bac40..147443c6 100644 --- a/src/locales/zh-CN/common.ts +++ b/src/locales/zh-CN/common.ts @@ -197,6 +197,7 @@ export default { 'common.button.docs': '文档', 'common.button.version': '版本', 'common.title.delete.confirm': '确认删除', + 'common.title.recreate.confirm': '确认重新创建', 'common.button.addLabel': '添加标签', 'common.button.addSelector': '添加选择器', 'common.button.addParams': '添加参数', diff --git a/src/pages/llmodels/components/table-list.tsx b/src/pages/llmodels/components/table-list.tsx index 61d42a16..1961458c 100644 --- a/src/pages/llmodels/components/table-list.tsx +++ b/src/pages/llmodels/components/table-list.tsx @@ -449,6 +449,7 @@ const Models: React.FC = ({ const handleDeleteInstace = (row: any, list: ModelInstanceListItem[]) => { modalRef.current.show({ content: 'models.instances', + okText: 'common.button.recreate', name: row.name, async onOk() { await deleteModelInstance(row.id);