This is an automated email from the ASF dual-hosted git repository.
likeguo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu-dashboard.git
The following commit(s) were added to refs/heads/master by this push:
new 5ff43839 [Fix] Optimizing api tag delete operation (#375)
5ff43839 is described below
commit 5ff43839bb707b6b11e333339de5668a31175896
Author: VampireAchao <[email protected]>
AuthorDate: Thu Nov 2 16:19:26 2023 +0800
[Fix] Optimizing api tag delete operation (#375)
---
src/routes/Document/ApiDoc.js | 1 +
src/routes/Document/components/SearchApi.js | 3 +++
src/routes/Document/components/TagInfo.js | 22 ++++++++++++++++++----
3 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/src/routes/Document/ApiDoc.js b/src/routes/Document/ApiDoc.js
index b5f68a0a..78a04413 100644
--- a/src/routes/Document/ApiDoc.js
+++ b/src/routes/Document/ApiDoc.js
@@ -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');
diff --git a/src/routes/Document/components/SearchApi.js
b/src/routes/Document/components/SearchApi.js
index f5f1d14c..34521d76 100644
--- a/src/routes/Document/components/SearchApi.js
+++ b/src/routes/Document/components/SearchApi.js
@@ -64,6 +64,9 @@ const SearchApi = React.forwardRef((props, ref) => {
// 默认选中第一个
setSelectedKeys(["0"]);
onSelect(["0"], { node: { props: arr[0] } })
+ } else {
+ setTreeData(arr);
+ setSelectedKeys([]);
}
};
diff --git a/src/routes/Document/components/TagInfo.js
b/src/routes/Document/components/TagInfo.js
index 2f1c7682..75f913fd 100644
--- a/src/routes/Document/components/TagInfo.js
+++ b/src/routes/Document/components/TagInfo.js
@@ -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";
@@ -80,9 +80,23 @@ function TagInfo(props) {
{getIntlContent("SHENYU.BUTTON.SYSTEM.EDIT")}
</Button>
- <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>