Skip to content

Commit

Permalink
fix: update goBackURL logic to correctly handle resource types for Ma…
Browse files Browse the repository at this point in the history
…nifest and PipelineStrategy
  • Loading branch information
AbhishekA1509 committed Feb 14, 2025
1 parent ba9d4e2 commit 1d90e58
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -320,16 +320,15 @@ const AppComposeRouter = () => {
const envOverridePath = match.params.envId
? `/${URLS.APP_ENV_OVERRIDE_CONFIG}/${match.params.envId}`
: `/${URLS.BASE_CONFIG}`
// Set the resourceTypePath based on the resourceType from the URL parameters.
// If the resourceType is 'Manifest' or 'PipelineStrategy', use 'deployment-template' as the back URL.
// Otherwise, use the actual resourceType from the URL, which could be 'deployment-template', 'configmap', or 'secrets'.
const resourceTypePath = `/${match.params.resourceType === EnvResourceType.Manifest || match.params.resourceType === EnvResourceType.PipelineStrategy ? EnvResourceType.DeploymentTemplate : match.params.resourceType}`

// Used in CM/CS
const resourceNamePath = match.params.resourceName ? `/${match.params.resourceName}` : ''

const goBackURL =
match.params.resourceType === EnvResourceType.Manifest
match.params.resourceType === EnvResourceType.Manifest ||
match.params.resourceType === EnvResourceType.PipelineStrategy
? `${basePath}${envOverridePath}`
: `${basePath}${envOverridePath}${resourceTypePath}${resourceNamePath}`
: `${basePath}${envOverridePath}/${match.params.resourceType}${resourceNamePath}`

return (
<DeploymentConfigCompare
Expand Down
10 changes: 4 additions & 6 deletions src/Pages/Releases/Detail/Configurations/Configurations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,16 +185,14 @@ export const Configurations = () => {
>
{({ match, location }) => {
const basePath = generatePath(path, match.params)
// Set the resourceTypePath based on the resourceType from the URL parameters.
// If the resourceType is 'Manifest' or 'PipelineStrategy', use 'deployment-template' as the back URL.
// Otherwise, use the actual resourceType from the URL, which could be 'deployment-template', 'configmap', or 'secrets'.
const resourceTypePath = `/${match.params.resourceType === EnvResourceType.Manifest || match.params.resourceType === EnvResourceType.PipelineStrategy ? EnvResourceType.DeploymentTemplate : match.params.resourceType}`
// Used in cm/cs
const resourceNamePath = match.params.resourceName ? `/${match.params.resourceName}` : ''

const goBackURL =
match.params.resourceType === EnvResourceType.Manifest
match.params.resourceType === EnvResourceType.Manifest ||
match.params.resourceType === EnvResourceType.PipelineStrategy
? basePath
: `${basePath}${resourceTypePath}${resourceNamePath}`
: `${basePath}/${match.params.resourceType}${resourceNamePath}`

return showConfig ? (
<DeploymentConfigCompare
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,13 @@ const EnvConfig = ({ filteredAppIds, envName }: AppGroupDetailDefaultType) => {
>
{({ match, location }) => {
const basePath = generatePath(path, match.params)
// Set the resourceTypePath based on the resourceType from the URL parameters.
// If the resourceType is 'Manifest' or 'PipelineStrategy', use 'deployment-template' as the back URL.
// Otherwise, use the actual resourceType from the URL, which could be 'deployment-template', 'configmap', or 'secrets'.
const resourceTypePath = `/${match.params.resourceType === EnvResourceType.Manifest || match.params.resourceType === EnvResourceType.PipelineStrategy ? EnvResourceType.DeploymentTemplate : match.params.resourceType}`
// Used in cm/cs
const resourceNamePath = match.params.resourceName ? `/${match.params.resourceName}` : ''

const goBackURL =
match.params.resourceType === EnvResourceType.Manifest
match.params.resourceType === EnvResourceType.Manifest ||
match.params.resourceType === EnvResourceType.PipelineStrategy
? basePath
: `${basePath}${resourceTypePath}${resourceNamePath}`
: `${basePath}/${match.params.resourceType}${resourceNamePath}`

return (
<DeploymentConfigCompare
Expand Down

0 comments on commit 1d90e58

Please sign in to comment.