You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by li...@apache.org on 2022/12/07 02:10:00 UTC

[shenyu-dashboard] branch master updated: Fixed naming conflicts between plugin attributes and plugin config attributes (#256)

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 6dcc9d6d Fixed naming conflicts between plugin attributes and plugin config attributes (#256)
6dcc9d6d is described below

commit 6dcc9d6d58df6810515720f52fec1c3e37928cc1
Author: Liming Deng <li...@gmail.com>
AuthorDate: Wed Dec 7 10:09:54 2022 +0800

    Fixed naming conflicts between plugin attributes and plugin config attributes (#256)
    
    * Fixed naming conflicts between plugin attributes and plugin config attributes
    
    * try to fix lint error
---
 .github/workflows/build.yml          |  3 ++-
 src/routes/System/Plugin/AddModal.js | 11 ++++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index c56bd86a..89332a7a 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -13,7 +13,7 @@ jobs:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        node-version: [8.x, 10.x, 12.x]
+        node-version: [10.x, 12.x, 14.x, 16.x]
     steps:
       - uses: actions/checkout@v2
       - name: Use Node.js ${{ matrix.node-version }}
@@ -22,4 +22,5 @@ jobs:
           node-version: ${{ matrix.node-version }}
       - run: npm install
       - run: npm run lint
+        if: matrix.node-version == '12.x'
       - run: npm run build --if-present
diff --git a/src/routes/System/Plugin/AddModal.js b/src/routes/System/Plugin/AddModal.js
index a609d1b5..af3bc3dd 100644
--- a/src/routes/System/Plugin/AddModal.js
+++ b/src/routes/System/Plugin/AddModal.js
@@ -36,8 +36,9 @@ class AddModal extends Component {
         if (data && data.length > 0) {
           config = {};
           data.forEach(item => {
-            if (values[item.field]) {
-              config[item.field] = values[item.field];
+            let fieldName = `__${  item.field}__`
+            if (values[fieldName]) {
+              config[item.field] = values[fieldName];
             }
           });
           config = JSON.stringify(config);
@@ -113,7 +114,8 @@ class AddModal extends Component {
                   let fieldInitialValue = config
                     ? config[eachField.field]
                     : undefined;
-                  let fieldName = eachField.field;
+                  // Add prefixes to prevent naming conflicts
+                  let fieldName = `__${  eachField.field}__`;
                   let dataType = eachField.dataType;
                   let required = "";
                   let checkRule;
@@ -147,6 +149,7 @@ class AddModal extends Component {
                     return (
                       <FormItem
                         label={eachField.label}
+                        name={fieldName}
                         {...formItemLayout}
                         key={index}
                       >
@@ -162,6 +165,7 @@ class AddModal extends Component {
                     return (
                       <FormItem
                         label={eachField.label}
+                        name={fieldName}
                         {...formItemLayout}
                         key={index}
                       >
@@ -188,6 +192,7 @@ class AddModal extends Component {
                     return (
                       <FormItem
                         label={eachField.label}
+                        name={fieldName}
                         {...formItemLayout}
                         key={index}
                       >