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

dengliming 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 223c188d [type:feat]discovery module adaptation namespace (#482)
223c188d is described below

commit 223c188d858da5fd7e9104e8f7232a769efc0f3c
Author: VampireAchao <ac...@apache.org>
AuthorDate: Sun Sep 29 20:16:01 2024 +0800

    [type:feat]discovery module adaptation namespace (#482)
---
 src/routes/Plugin/Common/index.js                  | 12 +++++++--
 .../Plugin/Discovery/DiscoveryImportModal.js       |  3 ++-
 src/routes/Plugin/Discovery/ProxySelectorCopy.js   |  6 +++++
 src/routes/Plugin/Discovery/index.js               | 30 +++++++++++++++++-----
 4 files changed, 42 insertions(+), 9 deletions(-)

diff --git a/src/routes/Plugin/Common/index.js 
b/src/routes/Plugin/Common/index.js
index 56198ce7..88d7417d 100755
--- a/src/routes/Plugin/Common/index.js
+++ b/src/routes/Plugin/Common/index.js
@@ -269,6 +269,7 @@ export default class Common extends Component {
                     selectedDiscoveryType,
                     serverList,
                     discoveryProps,
+                    namespaceId: currentNamespaceId,
                   });
                   this.closeModal();
                 },
@@ -421,6 +422,7 @@ export default class Common extends Component {
   };
 
   getUpstreamsWithProps = (upstreams) => {
+    const { currentNamespaceId } = this.props;
     return upstreams.map((item) => ({
       protocol: item.protocol,
       url: item.url,
@@ -430,6 +432,7 @@ export default class Common extends Component {
       props: JSON.stringify({
         warmupTime: item.warmupTime,
       }),
+      namespaceId: currentNamespaceId,
     }));
   };
 
@@ -445,6 +448,7 @@ export default class Common extends Component {
     selectedDiscoveryType,
     serverList,
     discoveryProps,
+    namespaceId,
   }) => {
     const { dispatch } = this.props;
     dispatch({
@@ -464,12 +468,13 @@ export default class Common extends Component {
           props: discoveryProps,
           name: selectorName,
         },
+        namespaceId,
       },
     });
   };
 
   updateDiscoveryUpstream = (discoveryHandlerId, upstreams) => {
-    const { dispatch } = this.props;
+    const { dispatch, currentNamespaceId } = this.props;
     const upstreamsWithHandlerId = upstreams.map((item) => ({
       protocol: item.protocol,
       url: item.url,
@@ -479,6 +484,7 @@ export default class Common extends Component {
         warmupTime: item.warmupTime,
       }),
       discoveryHandlerId,
+      namespaceId: currentNamespaceId,
     }));
     dispatch({
       type: "discovery/updateDiscoveryUpstream",
@@ -596,6 +602,7 @@ export default class Common extends Component {
                           selectedDiscoveryType,
                           serverList,
                           discoveryProps,
+                          namespaceId: currentNamespaceId,
                         });
                       } else {
                         this.updateDiscoveryUpstream(
@@ -739,7 +746,7 @@ export default class Common extends Component {
   // select
   rowClick = (record) => {
     const { id } = record;
-    const { dispatch } = this.props;
+    const { dispatch, currentNamespaceId } = this.props;
     const { selectorPageSize } = this.state;
     dispatch({
       type: "common/saveCurrentSelector",
@@ -753,6 +760,7 @@ export default class Common extends Component {
         currentPage: 1,
         pageSize: selectorPageSize,
         selectorId: id,
+        namespaceId: currentNamespaceId,
       },
     });
   };
diff --git a/src/routes/Plugin/Discovery/DiscoveryImportModal.js 
b/src/routes/Plugin/Discovery/DiscoveryImportModal.js
index a31f6a6a..e48b5980 100644
--- a/src/routes/Plugin/Discovery/DiscoveryImportModal.js
+++ b/src/routes/Plugin/Discovery/DiscoveryImportModal.js
@@ -33,12 +33,13 @@ class DiscoveryImportModal extends Component {
   }
 
   componentDidMount() {
-    const { dispatch, pluginName } = this.props;
+    const { dispatch, pluginName, currentNamespaceId } = this.props;
     dispatch({
       type: "discovery/fetchDiscovery",
       payload: {
         pluginName,
         level: "1",
+        namespaceId: currentNamespaceId,
       },
       callback: (discoveryConfigList) => {
         this.setState({ configList: discoveryConfigList });
diff --git a/src/routes/Plugin/Discovery/ProxySelectorCopy.js 
b/src/routes/Plugin/Discovery/ProxySelectorCopy.js
index 831e30fb..b2d598da 100644
--- a/src/routes/Plugin/Discovery/ProxySelectorCopy.js
+++ b/src/routes/Plugin/Discovery/ProxySelectorCopy.js
@@ -17,9 +17,13 @@
 
 import React, { Component } from "react";
 import { Modal, Select } from "antd";
+import { connect } from "dva";
 import { fetchProxySelector } from "../../../services/api";
 import { getIntlContent } from "../../../utils/IntlUtils";
 
+@connect(({ global }) => ({
+  currentNamespaceId: global.currentNamespaceId,
+}))
 class ProxySelectorCopy extends Component {
   constructor(props) {
     super(props);
@@ -71,11 +75,13 @@ class ProxySelectorCopy extends Component {
   }
 
   getAllSelectors = async () => {
+    const { currentNamespaceId } = this.props;
     const {
       data: { dataList: selectors = [] },
     } = await fetchProxySelector({
       currentPage: 1,
       pageSize: 9999,
+      namespaceId: currentNamespaceId,
     });
     this.setState({ selectorList: selectors });
   };
diff --git a/src/routes/Plugin/Discovery/index.js 
b/src/routes/Plugin/Discovery/index.js
index 9b8f841a..bbe6d4c5 100644
--- a/src/routes/Plugin/Discovery/index.js
+++ b/src/routes/Plugin/Discovery/index.js
@@ -19,13 +19,13 @@ import React, { Component } from "react";
 import { connect } from "dva";
 import {
   Button,
+  Input,
+  message,
   Pagination,
   Row,
   Switch,
   Tag,
-  Input,
   Typography,
-  message,
 } from "antd";
 import { getIntlContent } from "../../../utils/IntlUtils";
 import discoveryStyles from "./discovery.less";
@@ -78,13 +78,14 @@ export default class DiscoveryProxy extends Component {
   }
 
   componentDidMount() {
-    const { dispatch, currentPage, pageSize } = this.props;
+    const { dispatch, currentPage, pageSize, currentNamespaceId } = this.props;
     dispatch({
       type: "discovery/fetchProxySelectors",
       payload: {
         name: "",
         currentPage,
         pageSize,
+        namespaceId: currentNamespaceId,
       },
     });
 
@@ -117,6 +118,7 @@ export default class DiscoveryProxy extends Component {
   }
 
   onPageChange = (page, pageSize) => {
+    const { currentNamespaceId } = this.props;
     this.props.dispatch({
       type: "discovery/setCurrentPage",
       payload: {
@@ -131,6 +133,7 @@ export default class DiscoveryProxy extends Component {
         currentPage: page,
         pageSize,
         name: searchKey,
+        namespaceId: currentNamespaceId,
       },
     });
   };
@@ -184,13 +187,14 @@ export default class DiscoveryProxy extends Component {
   };
 
   addConfiguration = () => {
-    const { dispatch, typeEnums } = this.props;
+    const { dispatch, typeEnums, currentNamespaceId } = this.props;
     const { discoveryDics, pluginName } = this.state;
     dispatch({
       type: "discovery/fetchDiscovery",
       payload: {
         pluginName,
         level: "1",
+        namespaceId: currentNamespaceId,
       },
       callback: (discoveryConfigList) => {
         let discoveryId = "";
@@ -219,6 +223,7 @@ export default class DiscoveryProxy extends Component {
                     pluginName,
                     level: 1,
                     id: discoveryId,
+                    namespaceId: currentNamespaceId,
                   },
                   callback: () => {
                     this.closeModal();
@@ -262,19 +267,27 @@ export default class DiscoveryProxy extends Component {
 
   searchSelector = () => {
     const { searchKey } = this.state;
-    const { currentPage, pageSize } = this.props;
+    const { currentPage, pageSize, currentNamespaceId } = this.props;
     this.props.dispatch({
       type: "discovery/fetchProxySelectors",
       payload: {
         currentPage,
         pageSize,
         name: searchKey,
+        namespaceId: currentNamespaceId,
       },
     });
   };
 
   addSelector = () => {
-    const { dispatch, currentPage, pageSize, plugins, typeEnums } = this.props;
+    const {
+      dispatch,
+      currentPage,
+      pageSize,
+      plugins,
+      typeEnums,
+      currentNamespaceId,
+    } = this.props;
     const { cardData, discoveryDics, pluginName } = this.state;
     const plugin = this.getPlugin(plugins, pluginName);
     dispatch({
@@ -282,6 +295,7 @@ export default class DiscoveryProxy extends Component {
       payload: {
         pluginName,
         level: "1",
+        namespaceId: currentNamespaceId,
       },
       callback: (discoveryConfigList) => {
         let discoveryType = "";
@@ -345,6 +359,7 @@ export default class DiscoveryProxy extends Component {
                       props: discoveryProps,
                     },
                     discoveryUpstreams: upstreamsWithProps,
+                    namespaceId: currentNamespaceId,
                   },
                   callback: () => {
                     this.closeModal();
@@ -374,6 +389,7 @@ export default class DiscoveryProxy extends Component {
       pageSize,
       plugins,
       typeEnums,
+      currentNamespaceId,
     } = this.props;
     const { discoveryDics, pluginName } = this.state;
     const data = proxySelectorList.find((value) => value.id === id);
@@ -444,6 +460,7 @@ export default class DiscoveryProxy extends Component {
                   props: discoveryProps,
                 },
                 discoveryUpstreams: upstreamsWithProps,
+                namespaceId: currentNamespaceId,
               },
               callback: () => {
                 this.closeUpdateModal();
@@ -451,6 +468,7 @@ export default class DiscoveryProxy extends Component {
               fetchValue: {
                 currentPage,
                 pageSize,
+                namespaceId: currentNamespaceId,
               },
             });
           }}

Reply via email to