Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Optimizing api tag delete operation #375

Merged
merged 1 commit into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/routes/Document/ApiDoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ function ApiDoc() {
message.success(msg);
if (tagDetail.id) {
searchApiRef.current?.updateTree(null, 'tag');
setTagDetail({});
}
if (apiDetail.id) {
searchApiRef.current?.updateTree(null, 'api');
Expand Down
3 changes: 3 additions & 0 deletions src/routes/Document/components/SearchApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ const SearchApi = React.forwardRef((props, ref) => {
// 默认选中第一个
setSelectedKeys(["0"]);
onSelect(["0"], { node: { props: arr[0] } })
} else {
setTreeData(arr);
setSelectedKeys([]);
}
};

Expand Down
22 changes: 18 additions & 4 deletions src/routes/Document/components/TagInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

import { Typography, Button, Row, Col, Table } from "antd";
import {Typography, Button, Row, Col, Table, Popconfirm} from "antd";
import React, { useContext } from "react";
import dayjs from "dayjs";
import ApiContext from "./ApiContext";
Expand Down Expand Up @@ -80,9 +80,23 @@ function TagInfo(props) {
{getIntlContent("SHENYU.BUTTON.SYSTEM.EDIT")}
</Button>
&nbsp;&nbsp;
<Button ghost type="danger" onClick={handleDelete}>
{getIntlContent("SHENYU.BUTTON.SYSTEM.DELETE")}
</Button>
<Popconfirm
title={getIntlContent("SHENYU.COMMON.DELETE")}
placement="bottom"
onCancel={e => {
e.stopPropagation();
}}
onConfirm={e => {
e.stopPropagation();
handleDelete(e)
}}
okText={getIntlContent("SHENYU.COMMON.SURE")}
cancelText={getIntlContent("SHENYU.COMMON.CALCEL")}
>
<Button ghost type="danger">
{getIntlContent("SHENYU.BUTTON.SYSTEM.DELETE")}
</Button>
</Popconfirm>
</Col>
<Col span={12}>
<Text>
Expand Down
Loading