You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by mi...@apache.org on 2024/03/07 07:21:03 UTC

(incubator-devlake) branch fix-project-path-error created (now e78ac70a6)

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

mintsweet pushed a change to branch fix-project-path-error
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


      at e78ac70a6 fix: project path error

This branch includes the following new commits:

     new e78ac70a6 fix: project path error

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(incubator-devlake) 01/01: fix: project path error

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mintsweet pushed a commit to branch fix-project-path-error
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit e78ac70a62687b45c4665d74da499a8b39185610
Author: mintsweet <0x...@gmail.com>
AuthorDate: Thu Mar 7 20:20:46 2024 +1300

    fix: project path error
---
 config-ui/src/config/paths.ts                          | 18 ++++++++++++++++--
 .../src/routes/blueprint/connection-detail/index.tsx   |  2 +-
 config-ui/src/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 001f6543c..df7e6ab85 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 79d9fb527..35687cb29 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 e8c987f58..b4d58370a 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 432ccfc05..9889bfcea 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) => (
-              <Link to={PATHS.PROJECT(name, 'configuration')} style={{ color: '#292b3f' }}>
+              <Link to={PATHS.PROJECT(name, { tab: 'configuration' })} style={{ color: '#292b3f' }}>
                 {name}
               </Link>
             ),
@@ -192,7 +192,7 @@ export const ProjectHomePage = () => {
               <Button
                 type="primary"
                 icon={<SettingOutlined />}
-                onClick={() => navigate(PATHS.PROJECT(name, 'configuration'))}
+                onClick={() => navigate(PATHS.PROJECT(name, { tab: 'configuration' }))}
               />
             ),
           },