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 cc86c20a refactor: add popconfirm when deleting the selector (#300)
cc86c20a is described below

commit cc86c20aba1510e81542fed7ca9fad82a3c816b8
Author: lulu <[email protected]>
AuthorDate: Tue Jul 25 14:19:01 2023 +0800

    refactor: add popconfirm when deleting the selector (#300)
    
    * fix: warning message display error
    
    * refactor: add popconfirm when deleting the selector
    
    * fix: authbutton bug
---
 src/locales/en-US.json                 |  1 +
 src/locales/zh-CN.json                 |  1 +
 src/models/plugin.js                   |  2 +-
 src/routes/Plugin/Discovery/TcpCard.js | 17 +++++++++++++----
 4 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/locales/en-US.json b/src/locales/en-US.json
index e6311646..4aef94ec 100644
--- a/src/locales/en-US.json
+++ b/src/locales/en-US.json
@@ -388,5 +388,6 @@
   "SHENYU.DISCOVERY.SELECTOR.UPSTREAM.DateUpdated": "DateUpdated",
   "SHENYU.DISCOVERY.SELECTOR.CONFIG.BASIC": "Basic Config",
   "SHENYU.DISCOVERY.SELECTOR.CONFIG.DISCOVERY": "Discovery Config",
+  "SHENYU.DISCOVERY.SELECTOR.DELETE.CONFIRM": "Are you sure to delete this 
selector?",
   "SHENYU.COMMON.REFRESH": "Refresh"
 }
diff --git a/src/locales/zh-CN.json b/src/locales/zh-CN.json
index e8bd8240..34d926f3 100644
--- a/src/locales/zh-CN.json
+++ b/src/locales/zh-CN.json
@@ -375,5 +375,6 @@
   "SHENYU.DISCOVERY.SELECTOR.UPSTREAM.DateUpdated": "更新时间",
   "SHENYU.DISCOVERY.SELECTOR.CONFIG.BASIC": "基本配置",
   "SHENYU.DISCOVERY.SELECTOR.CONFIG.DISCOVERY": "服务发现",
+  "SHENYU.DISCOVERY.SELECTOR.DELETE.CONFIRM": "确定删除该选择器吗?",
   "SHENYU.COMMON.REFRESH": "刷新"
 }
diff --git a/src/models/plugin.js b/src/models/plugin.js
index 4841c4a7..08b9eb2a 100644
--- a/src/models/plugin.js
+++ b/src/models/plugin.js
@@ -152,7 +152,7 @@ export default {
         message.success(getIntlContent("SHENYU.COMMON.RESPONSE.ADD.SUCCESS"));
         callback(json)
       } else {
-        message.warn(json.message.split(":")[1]);
+        message.warn(json.message);
       }
     }
 
diff --git a/src/routes/Plugin/Discovery/TcpCard.js 
b/src/routes/Plugin/Discovery/TcpCard.js
index 15cc0b2a..55d79b12 100644
--- a/src/routes/Plugin/Discovery/TcpCard.js
+++ b/src/routes/Plugin/Discovery/TcpCard.js
@@ -16,7 +16,7 @@
  */
 
 import React, {Component} from "react";
-import {Card, Popover, Typography, Skeleton, Icon} from "antd";
+import {Card, Popover, Typography, Skeleton, Icon, Popconfirm} from "antd";
 
 import {getIntlContent} from "../../../utils/IntlUtils";
 import tcpStyles from "./tcp.less";
@@ -75,9 +75,18 @@ export class TcpCard extends Component {
             <AuthButton perms="plugin:tcp:modify">
               <Icon type="edit" key="edit" style={{color: "#1352A2", fontSize: 
"17px"}} onClick={() => updateSelector(data.id)} />
             </AuthButton>,
-            <AuthButton perms="plugin:tcpSelector:delete">
-              <Icon type="delete" key="delete" style={{color: "#CC0000", 
fontSize: "17px"}} onClick={() => handleDelete(data.id)} />
-            </AuthButton>
+            <Popconfirm
+              
title={getIntlContent("SHENYU.DISCOVERY.SELECTOR.DELETE.CONFIRM")}
+              icon={<Icon type="question-circle-o" style={{ color: "#CC0000" 
}} />}
+              onConfirm={() => handleDelete(data.id)}
+              okText={getIntlContent("SHENYU.COMMON.YES")}
+              cancelText={getIntlContent("SHENYU.COMMON.NO")}
+              key="popconfirm"
+            >
+              <AuthButton perms="plugin:tcpSelector:delete">
+                <Icon type="delete" key="delete" style={{color: "#CC0000", 
fontSize: "17px"}} />
+              </AuthButton>,
+            </Popconfirm>
           ]}
           extra={<div style={{ fontSize: '15px', lineHeight: '1.5', 
marginRight: '14px'}}>{formatTimestamp(createTime)}</div>}
         >

Reply via email to