Skip to content

Commit 1d90e58

Browse files
committed
fix: update goBackURL logic to correctly handle resource types for Manifest and PipelineStrategy
1 parent ba9d4e2 commit 1d90e58

File tree

3 files changed

+13
-19
lines changed

3 files changed

+13
-19
lines changed

src/Pages/Applications/DevtronApps/Details/AppConfigurations/MainContent/AppComposeRouter.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -320,16 +320,15 @@ const AppComposeRouter = () => {
320320
const envOverridePath = match.params.envId
321321
? `/${URLS.APP_ENV_OVERRIDE_CONFIG}/${match.params.envId}`
322322
: `/${URLS.BASE_CONFIG}`
323-
// Set the resourceTypePath based on the resourceType from the URL parameters.
324-
// If the resourceType is 'Manifest' or 'PipelineStrategy', use 'deployment-template' as the back URL.
325-
// Otherwise, use the actual resourceType from the URL, which could be 'deployment-template', 'configmap', or 'secrets'.
326-
const resourceTypePath = `/${match.params.resourceType === EnvResourceType.Manifest || match.params.resourceType === EnvResourceType.PipelineStrategy ? EnvResourceType.DeploymentTemplate : match.params.resourceType}`
323+
324+
// Used in CM/CS
327325
const resourceNamePath = match.params.resourceName ? `/${match.params.resourceName}` : ''
328326

329327
const goBackURL =
330-
match.params.resourceType === EnvResourceType.Manifest
328+
match.params.resourceType === EnvResourceType.Manifest ||
329+
match.params.resourceType === EnvResourceType.PipelineStrategy
331330
? `${basePath}${envOverridePath}`
332-
: `${basePath}${envOverridePath}${resourceTypePath}${resourceNamePath}`
331+
: `${basePath}${envOverridePath}/${match.params.resourceType}${resourceNamePath}`
333332

334333
return (
335334
<DeploymentConfigCompare

src/Pages/Releases/Detail/Configurations/Configurations.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,16 +185,14 @@ export const Configurations = () => {
185185
>
186186
{({ match, location }) => {
187187
const basePath = generatePath(path, match.params)
188-
// Set the resourceTypePath based on the resourceType from the URL parameters.
189-
// If the resourceType is 'Manifest' or 'PipelineStrategy', use 'deployment-template' as the back URL.
190-
// Otherwise, use the actual resourceType from the URL, which could be 'deployment-template', 'configmap', or 'secrets'.
191-
const resourceTypePath = `/${match.params.resourceType === EnvResourceType.Manifest || match.params.resourceType === EnvResourceType.PipelineStrategy ? EnvResourceType.DeploymentTemplate : match.params.resourceType}`
188+
// Used in cm/cs
192189
const resourceNamePath = match.params.resourceName ? `/${match.params.resourceName}` : ''
193190

194191
const goBackURL =
195-
match.params.resourceType === EnvResourceType.Manifest
192+
match.params.resourceType === EnvResourceType.Manifest ||
193+
match.params.resourceType === EnvResourceType.PipelineStrategy
196194
? basePath
197-
: `${basePath}${resourceTypePath}${resourceNamePath}`
195+
: `${basePath}/${match.params.resourceType}${resourceNamePath}`
198196

199197
return showConfig ? (
200198
<DeploymentConfigCompare

src/components/ApplicationGroup/Details/EnvironmentConfig/EnvConfig.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,13 @@ const EnvConfig = ({ filteredAppIds, envName }: AppGroupDetailDefaultType) => {
150150
>
151151
{({ match, location }) => {
152152
const basePath = generatePath(path, match.params)
153-
// Set the resourceTypePath based on the resourceType from the URL parameters.
154-
// If the resourceType is 'Manifest' or 'PipelineStrategy', use 'deployment-template' as the back URL.
155-
// Otherwise, use the actual resourceType from the URL, which could be 'deployment-template', 'configmap', or 'secrets'.
156-
const resourceTypePath = `/${match.params.resourceType === EnvResourceType.Manifest || match.params.resourceType === EnvResourceType.PipelineStrategy ? EnvResourceType.DeploymentTemplate : match.params.resourceType}`
153+
// Used in cm/cs
157154
const resourceNamePath = match.params.resourceName ? `/${match.params.resourceName}` : ''
158-
159155
const goBackURL =
160-
match.params.resourceType === EnvResourceType.Manifest
156+
match.params.resourceType === EnvResourceType.Manifest ||
157+
match.params.resourceType === EnvResourceType.PipelineStrategy
161158
? basePath
162-
: `${basePath}${resourceTypePath}${resourceNamePath}`
159+
: `${basePath}/${match.params.resourceType}${resourceNamePath}`
163160

164161
return (
165162
<DeploymentConfigCompare

0 commit comments

Comments
 (0)