This is an automated email from the ASF dual-hosted git repository.
hefengen 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 11aa7b34 [type:fix] fix namespace url error (#486)
11aa7b34 is described below
commit 11aa7b34965723686a5009711a87b12b6fdd8169
Author: VampireAchao <[email protected]>
AuthorDate: Wed Sep 25 22:51:11 2024 +0800
[type:fix] fix namespace url error (#486)
* [type:fix] fix namespace url error
* [type:fix] fix namespace url error
* [type:fix] fix namespace url error
---
src/routes/System/NamespacePlugin/index.js | 14 +++--------
src/services/api.js | 37 ++++++++----------------------
src/utils/namespacePlugin.js | 8 +++----
3 files changed, 16 insertions(+), 43 deletions(-)
diff --git a/src/routes/System/NamespacePlugin/index.js
b/src/routes/System/NamespacePlugin/index.js
index c983d9f7..f94607a9 100644
--- a/src/routes/System/NamespacePlugin/index.js
+++ b/src/routes/System/NamespacePlugin/index.js
@@ -143,7 +143,7 @@ export default class NamespacePlugin extends Component {
editClick = (record) => {
const { dispatch, currentNamespaceId } = this.props;
getUpdateModal({
- pluginId: record.pluginId,
+ id: record.id,
namespaceId: currentNamespaceId,
dispatch,
fetchValue: this.currentQueryPayload(),
@@ -231,20 +231,12 @@ export default class NamespacePlugin extends Component {
// 批量启用或禁用
enableClick = () => {
- const {
- dispatch,
- currentNamespaceId,
- namespacePlugin: { namespacePluginList },
- } = this.props;
+ const { dispatch, currentNamespaceId } = this.props;
const { selectedRowKeys } = this.state;
if (selectedRowKeys && selectedRowKeys.length > 0) {
dispatch({
type: "namespacePlugin/fetchItem",
- payload: {
- pluginId: namespacePluginList.find((i) => i.id ===
selectedRowKeys[0])
- ?.pluginId,
- namespaceId: currentNamespaceId,
- },
+ payload: { id: selectedRowKeys[0] },
callback: (user) => {
this.statusSwitch({
list: selectedRowKeys,
diff --git a/src/services/api.js b/src/services/api.js
index 81323f07..80396d16 100644
--- a/src/services/api.js
+++ b/src/services/api.js
@@ -551,12 +551,9 @@ export async function asyncConfigImport(params) {
// 同步单个插件
export async function asyncOnePlugin(params) {
- return request(
-
`${baseUrl}/namespacePlugin/syncPluginData?id=${params.id}&namespaceId=${params.namespaceId}`,
- {
- method: `PUT`,
- },
- );
+ return request(`${baseUrl}/namespacePlugin/syncPluginData?id=${params.id}`, {
+ method: `PUT`,
+ });
}
// get plugin dropdown list
@@ -1172,12 +1169,9 @@ export async function deleteNamespace(params) {
/* findNamespacePlugin */
export async function findNamespacePlugin(params) {
- return request(
- `${baseUrl}/namespacePlugin/${params.pluginId}/${params.namespaceId}`,
- {
- method: `GET`,
- },
- );
+ return request(`${baseUrl}/namespacePlugin/${params.id}`, {
+ method: `GET`,
+ });
}
/* getAllNamespacePlugins */
@@ -1194,27 +1188,16 @@ export async function
updateNamespacePluginEnabled(params) {
body: {
ids: params.list,
enabled: params.enabled,
- namespaceId: params.namespaceId,
},
});
}
/* updateNamespacePlugin */
export async function updateNamespacePlugin(params) {
- const formData = new FormData();
- formData.append("pluginId", params.pluginId);
- if (params.config) formData.append("config", params.config);
- formData.append("sort", params.sort);
- formData.append("enabled", params.enabled);
- formData.append("name", params.name);
- formData.append("namespaceId", params.namespaceId);
- return request(
-
`${baseUrl}/namespacePlugin?pluginId=${params.pluginId}&namespaceId=${params.namespaceId}`,
- {
- method: `PUT`,
- body: formData,
- },
- );
+ return request(`${baseUrl}/namespacePlugin/${params.id}`, {
+ method: `PUT`,
+ body: params,
+ });
}
/* deletePlugin */
diff --git a/src/utils/namespacePlugin.js b/src/utils/namespacePlugin.js
index 07da838c..fc701e47 100644
--- a/src/utils/namespacePlugin.js
+++ b/src/utils/namespacePlugin.js
@@ -20,7 +20,7 @@ import { refreshAuthMenus } from "./AuthRoute";
import AddModal from "../routes/System/NamespacePlugin/AddModal";
export function getUpdateModal({
- pluginId,
+ id,
namespaceId,
dispatch,
fetchValue,
@@ -30,10 +30,7 @@ export function getUpdateModal({
}) {
dispatch({
type: "namespacePlugin/fetchItem",
- payload: {
- pluginId,
- namespaceId,
- },
+ payload: { id },
callback: (plugin) => {
dispatch({
type: "namespacePlugin/fetchByPluginId",
@@ -53,6 +50,7 @@ export function getUpdateModal({
type: "namespacePlugin/update",
payload: {
config,
+ id: plugin.id,
pluginId: plugin.pluginId,
enabled,
namespaceId,