Skip to content

Commit 2244ec3

Browse files
committed
refactor: streamline navigation constants and update route paths for infrastructure management
1 parent dca3a3e commit 2244ec3

File tree

6 files changed

+46
-47
lines changed

6 files changed

+46
-47
lines changed

src/components/Navigation/constants.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import { generatePath } from 'react-router-dom'
22

3-
import {
4-
BackupLocationsTypes,
5-
InfrastructureManagementAppListType,
6-
URLS as COMMON_URLS,
7-
} from '@devtron-labs/devtron-fe-common-lib'
3+
import { BackupLocationsTypes, URLS as COMMON_URLS } from '@devtron-labs/devtron-fe-common-lib'
84

95
import { importComponentFromFELibrary } from '@Components/common'
106
import { Routes } from '@Config/constants'
@@ -204,7 +200,7 @@ export const NAVIGATION_LIST: NavigationGroupType[] = [
204200
dataTestId: 'click-on-devtron-application',
205201
id: 'application-management-devtron-applications',
206202
icon: 'ic-application',
207-
href: COMMON_URLS.APPLICATION_MANAGEMENT_APP_LIST,
203+
href: COMMON_URLS.APPLICATION_MANAGEMENT_APP,
208204
},
209205
{
210206
title: 'Application Groups',
@@ -268,9 +264,7 @@ export const NAVIGATION_LIST: NavigationGroupType[] = [
268264
dataTestId: 'click-on-application',
269265
id: 'infrastructure-management-applications',
270266
icon: 'ic-grid-view',
271-
href: generatePath(COMMON_URLS.INFRASTRUCTURE_MANAGEMENT_APP_LIST, {
272-
appType: InfrastructureManagementAppListType.HELM,
273-
}),
267+
href: COMMON_URLS.INFRASTRUCTURE_MANAGEMENT_APP,
274268
},
275269
{
276270
title: 'Chart Store',

src/components/app/details/AppHeader.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,14 @@ export const AppHeader = ({
137137
{
138138
alias: {
139139
...getApplicationManagementBreadcrumb(),
140+
'devtron-app': {
141+
component: <span className="cb-5 fs-16 dc__capitalize">Devtron Apps</span>,
142+
linked: true,
143+
},
140144
':appId(\\d+)': {
141145
component: <AppSelector onChange={handleAppChange} appId={appId} appName={appName} />,
142146
linked: false,
143147
},
144-
app: {
145-
component: <span className="cb-5 fs-16 dc__capitalize">devtron apps</span>,
146-
linked: true,
147-
},
148148
},
149149
},
150150
[appId, appName],

src/components/common/navigation/NavRoutes.components.tsx

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,15 @@
1515
*/
1616

1717
import { lazy, useEffect, useMemo, useState } from 'react'
18-
import { Redirect, Route, Switch, useHistory, useLocation, useRouteMatch } from 'react-router-dom'
18+
import { generatePath, Redirect, Route, Switch, useHistory, useLocation } from 'react-router-dom'
1919
import * as Sentry from '@sentry/browser'
2020

21-
import { SERVER_MODE, URLS as CommonURLS, useMainContext } from '@devtron-labs/devtron-fe-common-lib'
21+
import {
22+
InfrastructureManagementAppListType,
23+
SERVER_MODE,
24+
URLS as CommonURLS,
25+
useMainContext,
26+
} from '@devtron-labs/devtron-fe-common-lib'
2227

2328
import { URLS } from '@Config/routes'
2429

@@ -92,26 +97,32 @@ export const AppRouter = () => {
9297
)
9398
}
9499

95-
export const InfraAppsRouter = () => {
96-
const { path } = useRouteMatch()
97-
return (
98-
<Switch>
99-
<Route path={CommonURLS.INFRASTRUCTURE_MANAGEMENT_APP_LIST} render={() => <NewAppList />} />
100-
<Route path={`${path}/${URLS.EXTERNAL_APPS}/:appId/:appName`} render={() => <ExternalApps />} />
101-
<Route
102-
path={`${path}/${URLS.EXTERNAL_ARGO_APP}/:clusterId(\\d+)/:appName/:namespace`}
103-
render={() => <ExternalArgoApps />}
104-
/>
105-
{window._env_.FEATURE_EXTERNAL_FLUX_CD_ENABLE && (
106-
<Route path={`${path}/${URLS.EXTERNAL_FLUX_APP}/:clusterId/:appName/:namespace/:templateType`}>
107-
<ExternalFluxAppDetailsRoute />
108-
</Route>
109-
)}
100+
export const InfraAppsRouter = () => (
101+
<Switch>
102+
<Route path={CommonURLS.INFRASTRUCTURE_MANAGEMENT_APP_LIST} render={() => <NewAppList />} />
103+
<Route
104+
path={`${CommonURLS.INFRASTRUCTURE_MANAGEMENT_APP}/${URLS.EXTERNAL_APPS}/:appId/:appName`}
105+
render={() => <ExternalApps />}
106+
/>
107+
<Route
108+
path={`${CommonURLS.INFRASTRUCTURE_MANAGEMENT_APP}/${URLS.EXTERNAL_ARGO_APP}/:clusterId(\\d+)/:appName/:namespace`}
109+
render={() => <ExternalArgoApps />}
110+
/>
111+
{window._env_.FEATURE_EXTERNAL_FLUX_CD_ENABLE && (
110112
<Route
111-
path={`${path}/${URLS.DEVTRON_CHARTS}/deployments/:appId(\\d+)/env/:envId(\\d+)`}
112-
render={() => <DevtronChartRouter />}
113-
/>
114-
<Redirect to={CommonURLS.INFRASTRUCTURE_MANAGEMENT_APP_LIST} />
115-
</Switch>
116-
)
117-
}
113+
path={`${CommonURLS.INFRASTRUCTURE_MANAGEMENT_APP}/${URLS.EXTERNAL_FLUX_APP}/:clusterId/:appName/:namespace/:templateType`}
114+
>
115+
<ExternalFluxAppDetailsRoute />
116+
</Route>
117+
)}
118+
<Route
119+
path={`${CommonURLS.INFRASTRUCTURE_MANAGEMENT_APP}/${URLS.DEVTRON_CHARTS}/deployments/:appId(\\d+)/env/:envId(\\d+)`}
120+
render={() => <DevtronChartRouter />}
121+
/>
122+
<Redirect
123+
to={generatePath(CommonURLS.INFRASTRUCTURE_MANAGEMENT_APP_LIST, {
124+
appType: InfrastructureManagementAppListType.HELM,
125+
})}
126+
/>
127+
</Switch>
128+
)

src/components/common/navigation/NavigationRoutes.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -562,10 +562,7 @@ const NavigationRoutes = ({ reloadVersionConfig }: Readonly<NavigationRoutesType
562562
</Route>
563563
<Route
564564
key={CommonURLS.INFRASTRUCTURE_MANAGEMENT_APP}
565-
path={[
566-
CommonURLS.INFRASTRUCTURE_MANAGEMENT_APP_LIST,
567-
CommonURLS.INFRASTRUCTURE_MANAGEMENT_APP,
568-
]}
565+
path={CommonURLS.INFRASTRUCTURE_MANAGEMENT_APP}
569566
>
570567
<InfraAppsRouter />
571568
</Route>
@@ -576,10 +573,7 @@ const NavigationRoutes = ({ reloadVersionConfig }: Readonly<NavigationRoutesType
576573
{!window._env_.K8S_CLIENT && [
577574
<Route
578575
key={CommonURLS.APPLICATION_MANAGEMENT_APP}
579-
path={[
580-
CommonURLS.APPLICATION_MANAGEMENT_APP_LIST,
581-
URLS.APPLICATION_MANAGEMENT_APP,
582-
]}
576+
path={CommonURLS.APPLICATION_MANAGEMENT_APP}
583577
render={() => <AppRouter />}
584578
/>,
585579
<Route

src/components/v2/headers/ChartHeader.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const ChartHeaderComponent = ({ errorResponseCode }: ChartHeaderComponentType) =
3939
{
4040
alias: {
4141
...getInfrastructureManagementBreadcrumb(),
42-
app: {
42+
apps: {
4343
component: (
4444
<Link to={URLS.HELM_APP_LIST} className="dc__devtron-breadcrumb__item">
4545
<div className="cb-5">Helm Apps</div>

src/components/v2/headers/EAHeader.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const EAHeaderComponent = ({
4444
alias: {
4545
...getInfrastructureManagementBreadcrumb(),
4646
...breadCrumbConfig,
47-
app: {
47+
apps: {
4848
component: (
4949
<Link to={redirectURL} className="dc__devtron-breadcrumb__item">
5050
<div className="cb-5">{title}</div>

0 commit comments

Comments
 (0)