From 583912b9d8b66fccd7d09dcef13622a8d97daaea Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
<41898282+github-actions[bot]@users.noreply.github.com>
Date: Thu, 7 Mar 2024 21:29:01 +1300
Subject: [PATCH] fix: project path error (#7134) (#7136)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: 青湛 <0x1304570@gmail.com>
---
config-ui/src/config/paths.ts | 18 ++++++++++++++++--
.../blueprint/connection-detail/index.tsx | 2 +-
.../routes/project/detail/settings-panel.tsx | 2 +-
config-ui/src/routes/project/home/index.tsx | 4 ++--
4 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/config-ui/src/config/paths.ts b/config-ui/src/config/paths.ts
index baa9096e85e..c42d8bb528a 100644
--- a/config-ui/src/config/paths.ts
+++ b/config-ui/src/config/paths.ts
@@ -25,8 +25,22 @@ export const PATHS = {
CONNECTIONS: () => `${PATH_PREFIX}/connections`,
CONNECTION: (plugin: string, connectionId: ID) => `${PATH_PREFIX}/connections/${plugin}/${connectionId}`,
PROJECTS: () => `${PATH_PREFIX}/projects`,
- PROJECT: (pname: string, tab?: 'configuration' | 'status' | 'settings') =>
- `${PATH_PREFIX}/projects/${encodeName(pname)}${tab ? `?tab=${tab}` : ''}`,
+ PROJECT: (
+ pname: string,
+ { tab, tabId }: { tab?: 'configuration' | 'status'; tabId?: 'blueprint' | 'webhook' | 'settings' } = {},
+ ) => {
+ let params = '';
+
+ if (tab && tabId) {
+ params = `?tab=${tab}&tabId=${tabId}`;
+ } else if (tab) {
+ params = `?tab=${tab}`;
+ } else if (tabId) {
+ params = `?tabId=${tabId}`;
+ }
+
+ return `${PATH_PREFIX}/projects/${encodeName(pname)}${params}`;
+ },
PROJECT_CONNECTION: (pname: string, plugin: string, connectionId: ID) =>
`${PATH_PREFIX}/projects/${encodeName(pname)}/${plugin}-${connectionId}`,
BLUEPRINTS: () => `${PATH_PREFIX}/advanced/blueprints`,
diff --git a/config-ui/src/routes/blueprint/connection-detail/index.tsx b/config-ui/src/routes/blueprint/connection-detail/index.tsx
index 79d9fb52742..35687cb29ca 100644
--- a/config-ui/src/routes/blueprint/connection-detail/index.tsx
+++ b/config-ui/src/routes/blueprint/connection-detail/index.tsx
@@ -115,7 +115,7 @@ export const BlueprintConnectionDetailPage = () => {
if (success) {
handleShowTips();
- navigate(pname ? PATHS.PROJECT(pname, 'configuration') : PATHS.BLUEPRINT(blueprint.id, 'configuration'));
+ navigate(pname ? PATHS.PROJECT(pname, { tab: 'configuration' }) : PATHS.BLUEPRINT(blueprint.id, 'configuration'));
}
};
diff --git a/config-ui/src/routes/project/detail/settings-panel.tsx b/config-ui/src/routes/project/detail/settings-panel.tsx
index e8c987f581d..b4d58370af2 100644
--- a/config-ui/src/routes/project/detail/settings-panel.tsx
+++ b/config-ui/src/routes/project/detail/settings-panel.tsx
@@ -77,7 +77,7 @@ export const SettingsPanel = ({ project, onRefresh }: Props) => {
if (success) {
onRefresh();
- navigate(PATHS.PROJECT(name, 'settings'));
+ navigate(PATHS.PROJECT(name, { tabId: 'settings' }));
}
};
diff --git a/config-ui/src/routes/project/home/index.tsx b/config-ui/src/routes/project/home/index.tsx
index 432ccfc0575..9889bfceaa4 100644
--- a/config-ui/src/routes/project/home/index.tsx
+++ b/config-ui/src/routes/project/home/index.tsx
@@ -134,7 +134,7 @@ export const ProjectHomePage = () => {
dataIndex: 'name',
key: 'name',
render: (name: string) => (
-
+
{name}
),
@@ -192,7 +192,7 @@ export const ProjectHomePage = () => {
}
- onClick={() => navigate(PATHS.PROJECT(name, 'configuration'))}
+ onClick={() => navigate(PATHS.PROJECT(name, { tab: 'configuration' }))}
/>
),
},