Skip to content

Commit

Permalink
chore: the text on the recreate button
Browse files Browse the repository at this point in the history
  • Loading branch information
hibig committed Dec 19, 2024
1 parent f44aee0 commit 66d31da
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
24 changes: 20 additions & 4 deletions src/components/delete-modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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, () => ({
Expand All @@ -17,6 +24,9 @@ const DeleteModal = forwardRef((props, ref) => {
content: string;
selection?: boolean;
name?: string;
title?: string;
cancelText?: string;
okText?: string;
}
) => {
setConfig(data);
Expand Down Expand Up @@ -55,10 +65,14 @@ const DeleteModal = forwardRef((props, ref) => {
footer={
<Space size={20}>
<Button onClick={handleCancel} size="middle">
{intl.formatMessage({ id: 'common.button.cancel' })}
{config.cancelText
? intl.formatMessage({ id: config.cancelText })
: intl.formatMessage({ id: 'common.button.cancel' })}
</Button>
<Button type="primary" onClick={handleOk} size="middle">
{intl.formatMessage({ id: 'common.button.delete' })}
{config.okText
? intl.formatMessage({ id: config.okText })
: intl.formatMessage({ id: 'common.button.delete' })}
</Button>
</Space>
}
Expand All @@ -67,7 +81,9 @@ const DeleteModal = forwardRef((props, ref) => {
<span className="title">
<ExclamationCircleFilled />
<span>
{intl.formatMessage({ id: 'common.title.delete.confirm' })}
{config.title
? intl.formatMessage({ id: config.title })
: intl.formatMessage({ id: 'common.title.delete.confirm' })}
</span>
</span>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/locales/en-US/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
1 change: 1 addition & 0 deletions src/locales/zh-CN/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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': '添加参数',
Expand Down
1 change: 1 addition & 0 deletions src/pages/llmodels/components/table-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ const Models: React.FC<ModelsProps> = ({
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);
Expand Down

0 comments on commit 66d31da

Please sign in to comment.