-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
请不要在没有先创建Issue的情况下创建Pull Request。 ## 变更的目的是什么 XXXXX ## 简短的更新日志 XX ## 验证这一变化 XXXX 请遵循此清单,以帮助我们快速轻松地整合您的贡献: * [ ] 一个 PR(Pull Request的简写)只解决一个问题,禁止一个 PR 解决多个问题; * [ ] 确保 PR 有对应的 Issue(通常在您开始处理之前创建),除非是书写错误之类的琐碎更改不需要 Issue ; * [ ] 格式化 PR 及 Commit-Log 的标题及内容,例如 #861 。PS:Commit-Log 需要在 Git Commit 代码时进行填写,在 GitHub 上修改不了; * [ ] 编写足够详细的 PR 描述,以了解 PR 的作用、方式和原因; * [ ] 编写必要的单元测试来验证您的逻辑更正。如果提交了新功能或重大更改,请记住在 test 模块中添加 integration-test; * [ ] 确保编译通过,集成测试通过;
- Loading branch information
Showing
5 changed files
with
157 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
km-console/packages/layout-clusters-fe/src/pages/ConsumerGroup/Delete.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
import React, { useState } from 'react'; | ||
import { useParams } from 'react-router-dom'; | ||
import { Button, Form, Input, Modal, Utils } from 'knowdesign'; | ||
import notification from '@src/components/Notification'; | ||
import Api from '@src/api/index'; | ||
|
||
// eslint-disable-next-line react/display-name | ||
export default (props: { record: any; onConfirm?: () => void }) => { | ||
const { record, onConfirm } = props; | ||
const routeParams = useParams<{ | ||
clusterId: string; | ||
}>(); | ||
const [form] = Form.useForm(); | ||
const [delDialogVisible, setDelDialogVisble] = useState(false); | ||
const handleDelOk = () => { | ||
form.validateFields().then((e) => { | ||
const formVal = form.getFieldsValue(); | ||
formVal.clusterPhyId = Number(routeParams.clusterId); | ||
formVal.deleteType = 0; | ||
Utils.delete(Api.deleteGroupOffset(), { data: formVal }).then((res: any) => { | ||
if (res === null) { | ||
notification.success({ | ||
message: '删除消费组成功', | ||
}); | ||
setDelDialogVisble(false); | ||
onConfirm && onConfirm(); | ||
} else { | ||
notification.error({ | ||
message: '删除消费组失败', | ||
}); | ||
} | ||
}); | ||
}); | ||
}; | ||
return ( | ||
<> | ||
<Button | ||
style={{ paddingLeft: 0 }} | ||
type="link" | ||
onClick={(_) => { | ||
setDelDialogVisble(true); | ||
}} | ||
> | ||
删除 | ||
</Button> | ||
<Modal | ||
className="custom-modal" | ||
title="确定要删除此Topic吗?" | ||
centered={true} | ||
visible={delDialogVisible} | ||
wrapClassName="del-topic-modal" | ||
destroyOnClose={true} | ||
maskClosable={false} | ||
onOk={handleDelOk} | ||
onCancel={(_) => { | ||
setDelDialogVisble(false); | ||
}} | ||
okText="删除" | ||
okButtonProps={{ | ||
danger: true, | ||
size: 'small', | ||
style: { | ||
paddingLeft: '16px', | ||
paddingRight: '16px', | ||
}, | ||
}} | ||
cancelButtonProps={{ | ||
size: 'small', | ||
style: { | ||
paddingLeft: '16px', | ||
paddingRight: '16px', | ||
}, | ||
}} | ||
> | ||
{/* <div className="tip-info"> | ||
<IconFont type="icon-warning-circle"></IconFont> | ||
<span>会删除Topic的全部消息数据和ACL权限!请再次输入Topic名称进行确认!</span> | ||
</div> */} | ||
<Form form={form} labelCol={{ span: 5 }} style={{ marginTop: 18 }}> | ||
<Form.Item label="TopicName">{record.name}</Form.Item> | ||
<Form.Item | ||
name="groupName" | ||
label="GroupName" | ||
rules={[ | ||
// { required: true }, | ||
() => ({ | ||
validator(_, value) { | ||
if (!value) { | ||
return Promise.reject(new Error('请输入Group名称')); | ||
} else if (value !== record.name) { | ||
return Promise.reject(new Error('请输入正确的Group名称')); | ||
} | ||
return Promise.resolve(); | ||
}, | ||
}), | ||
]} | ||
> | ||
<Input placeholder="请输入" size="small"></Input> | ||
</Form.Item> | ||
</Form> | ||
</Modal> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters