fix routing reversion discussed with Tan

This commit is contained in:
Dan Wilson 2023-08-03 21:14:27 +01:00
parent 23923f9653
commit 74532bbd1b
2 changed files with 14 additions and 10 deletions

View File

@ -12,15 +12,19 @@ export interface CODEProps {
pullRequestSection?: string
webhookId?: string
pipeline?: string
pipelinePath?: string
execution?: string
executionPath?: string
}
export interface CODEQueryProps {
query?: string
}
export const pathProps: Readonly<Omit<Required<CODEProps>, 'repoPath' | 'branch' | 'tags' | 'pipelinePath'>> = {
space: ':space',
export const pathProps: Readonly<
Omit<Required<CODEProps>, 'repoPath' | 'branch' | 'tags' | 'pipelinePath' | 'executionPath'>
> = {
space: ':space*',
repoName: ':repoName',
gitRef: ':gitRef*',
resourcePath: ':resourcePath*',
@ -69,8 +73,8 @@ export interface CODERoutes {
toCODEWebhookDetails: (args: Required<Pick<CODEProps, 'repoPath' | 'webhookId'>>) => string
toCODESettings: (args: Required<Pick<CODEProps, 'repoPath'>>) => string
toCODEExecutions: (args: Required<Pick<CODEProps, 'space' | 'pipeline'>>) => string
toCODEExecution: (args: Required<Pick<CODEProps, 'space' | 'pipeline' | 'execution'>>) => string
toCODEExecutions: (args: Required<Pick<CODEProps, 'pipelinePath'>>) => string
toCODEExecution: (args: Required<Pick<CODEProps, 'executionPath'>>) => string
}
export const routes: CODERoutes = {
@ -112,6 +116,6 @@ export const routes: CODERoutes = {
toCODEWebhookNew: ({ repoPath }) => `/${repoPath}/webhooks/new`,
toCODEWebhookDetails: ({ repoPath, webhookId }) => `/${repoPath}/webhook/${webhookId}`,
toCODEExecutions: ({ space, pipeline }) => `/pipelines/${space}/${pipeline}`,
toCODEExecution: ({ space, pipeline, execution }) => `/pipelines/${space}/${pipeline}/${execution}`
toCODEExecutions: ({ pipelinePath }) => `/pipelines/${pipelinePath}`,
toCODEExecution: ({ executionPath }) => `/pipelines/${executionPath}`
}

View File

@ -34,6 +34,8 @@ import Execution from 'pages/Execution/Execution'
export const RouteDestinations: React.FC = React.memo(function RouteDestinations() {
const { getString } = useStrings()
const repoPath = `${pathProps.space}/${pathProps.repoName}`
const pipelinePath = `${pathProps.space}/${pathProps.pipeline}`
const executionPath = `${pathProps.space}/${pathProps.pipeline}/${pathProps.execution}`
const { OPEN_SOURCE_PIPELINES, OPEN_SOURCE_SECRETS } = useFeatureFlag()
@ -165,7 +167,7 @@ export const RouteDestinations: React.FC = React.memo(function RouteDestinations
)}
{OPEN_SOURCE_PIPELINES && (
<Route path={routes.toCODEExecutions({ space: pathProps.space, pipeline: pathProps.pipeline })} exact>
<Route path={routes.toCODEExecutions({ pipelinePath })} exact>
<LayoutWithSideNav title={getString('pageTitle.executions')}>
<ExecutionList />
</LayoutWithSideNav>
@ -175,9 +177,7 @@ export const RouteDestinations: React.FC = React.memo(function RouteDestinations
{OPEN_SOURCE_PIPELINES && (
<Route
path={routes.toCODEExecution({
space: pathProps.space,
pipeline: pathProps.pipeline,
execution: pathProps.execution
executionPath
})}
exact>
<LayoutWithSideNav title={getString('pageTitle.executions')}>