From 74532bbd1bcb477e59ec413e54a55273cacebc97 Mon Sep 17 00:00:00 2001 From: Dan Wilson Date: Thu, 3 Aug 2023 21:14:27 +0100 Subject: [PATCH] fix routing reversion discussed with Tan --- web/src/RouteDefinitions.ts | 16 ++++++++++------ web/src/RouteDestinations.tsx | 8 ++++---- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/web/src/RouteDefinitions.ts b/web/src/RouteDefinitions.ts index a9c4d2f97..ea2624dea 100644 --- a/web/src/RouteDefinitions.ts +++ b/web/src/RouteDefinitions.ts @@ -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, 'repoPath' | 'branch' | 'tags' | 'pipelinePath'>> = { - space: ':space', +export const pathProps: Readonly< + Omit, 'repoPath' | 'branch' | 'tags' | 'pipelinePath' | 'executionPath'> +> = { + space: ':space*', repoName: ':repoName', gitRef: ':gitRef*', resourcePath: ':resourcePath*', @@ -69,8 +73,8 @@ export interface CODERoutes { toCODEWebhookDetails: (args: Required>) => string toCODESettings: (args: Required>) => string - toCODEExecutions: (args: Required>) => string - toCODEExecution: (args: Required>) => string + toCODEExecutions: (args: Required>) => string + toCODEExecution: (args: Required>) => 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}` } diff --git a/web/src/RouteDestinations.tsx b/web/src/RouteDestinations.tsx index 81918644a..3643ddcb9 100644 --- a/web/src/RouteDestinations.tsx +++ b/web/src/RouteDestinations.tsx @@ -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 && ( - + @@ -175,9 +177,7 @@ export const RouteDestinations: React.FC = React.memo(function RouteDestinations {OPEN_SOURCE_PIPELINES && (