This is an automated email from the ASF dual-hosted git repository.

liuhongyu 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 7d5d4252 fix divide plugin: localizes status labels. (#529)
7d5d4252 is described below

commit 7d5d42523a5a3772a086bf19fabc5d2f9ea3cd98
Author: LingXiao Qi <148341767+fantasy-lo...@users.noreply.github.com>
AuthorDate: Sat May 10 16:09:20 2025 +0800

    fix divide plugin: localizes status labels. (#529)
    
    * Localizes status labels in DiscoveryUpstreamTable
    
    Replaces hardcoded status options with localized content using 
`getIntlContent` for better internationalization.
    
    Adjusts initial value handling for form fields and refines status rendering 
logic to ensure consistency.
    
    Improves maintainability and prepares the application for multi-language 
support.
    
    * fix code style
---
 src/routes/Plugin/Discovery/DiscoveryUpstreamTable.js | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/routes/Plugin/Discovery/DiscoveryUpstreamTable.js 
b/src/routes/Plugin/Discovery/DiscoveryUpstreamTable.js
index 3c08ebeb..c6fd43a1 100644
--- a/src/routes/Plugin/Discovery/DiscoveryUpstreamTable.js
+++ b/src/routes/Plugin/Discovery/DiscoveryUpstreamTable.js
@@ -40,8 +40,8 @@ class EditableCell extends Component {
       // return <Select />;
       return (
         <Select>
-          <Option value="0">open</Option>
-          <Option value="1">close</Option>
+          <Option value={0}>{getIntlContent("SHENYU.COMMON.OPEN")}</Option>
+          <Option value={1}>{getIntlContent("SHENYU.COMMON.CLOSE")}</Option>
         </Select>
       );
     } else if (this.props.inputType === "switch") {
@@ -83,7 +83,10 @@ class EditableCell extends Component {
                       message: `Please Input ${title}!`,
                     },
                   ],
-                  initialValue: record[dataIndex],
+                  initialValue:
+                    dataIndex === "status"
+                      ? Number(record[dataIndex])
+                      : record[dataIndex],
                 })(this.getInput())}
           </Form.Item>
         ) : (
@@ -129,7 +132,13 @@ class EditableTable extends Component {
         width: "19%",
         align: "center",
         render: (text) => {
-          return text === 0 || text === "0" ? "open" : "close";
+          const statusMap = {
+            0: getIntlContent("SHENYU.COMMON.OPEN"),
+            1: getIntlContent("SHENYU.COMMON.CLOSE"),
+            false: getIntlContent("SHENYU.COMMON.OPEN"),
+            true: getIntlContent("SHENYU.COMMON.CLOSE"),
+          };
+          return statusMap[text] || getIntlContent("SHENYU.COMMON.CLOSE");
         },
       },
       {

Reply via email to