Skip to content

Commit

Permalink
fix: project path error (#7134) (#7136)
Browse files Browse the repository at this point in the history
Co-authored-by: 青湛 <0x1304570@gmail.com>
  • Loading branch information
github-actions[bot] and mintsweet authored Mar 7, 2024
1 parent 60b9677 commit 583912b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
18 changes: 16 additions & 2 deletions config-ui/src/config/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand Down
2 changes: 1 addition & 1 deletion config-ui/src/routes/blueprint/connection-detail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}
};

Expand Down
2 changes: 1 addition & 1 deletion config-ui/src/routes/project/detail/settings-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const SettingsPanel = ({ project, onRefresh }: Props) => {

if (success) {
onRefresh();
navigate(PATHS.PROJECT(name, 'settings'));
navigate(PATHS.PROJECT(name, { tabId: 'settings' }));
}
};

Expand Down
4 changes: 2 additions & 2 deletions config-ui/src/routes/project/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
),
Expand Down Expand Up @@ -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' }))}
/>
),
},
Expand Down

0 comments on commit 583912b

Please sign in to comment.