Skip to content

Commit b66e3ca

Browse files
committed
fix: default landing to RB from login and bad url
1 parent 9136060 commit b66e3ca

File tree

4 files changed

+16
-20
lines changed

4 files changed

+16
-20
lines changed

src/components/common/navigation/Navigation.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import { getModuleInfo } from '../../v2/devtronStackManager/DevtronStackManager.
4646
import { ReactComponent as ResourceWatcherIcon } from '../../../assets/icons/ic-monitoring.svg'
4747
import { importComponentFromFELibrary } from '../helpers/Helpers'
4848
import { OrganizationFrame, OrganizationTextLogo } from '../../../Pages/Shared'
49+
import { MainContext } from './types'
4950

5051
const hideResourceWatcher = !importComponentFromFELibrary('ResourceWatcherRouter')
5152
const hideSoftwareDistributionHub = !importComponentFromFELibrary('SoftwareDistributionHub', null, 'function')
@@ -179,6 +180,7 @@ interface NavigationType extends RouteComponentProps<{}> {
179180
installedModuleMap: React.MutableRefObject<Record<string, boolean>>
180181
isSuperAdmin: boolean
181182
isAirgapped: boolean
183+
currentServerInfo: MainContext['currentServerInfo']
182184
}
183185

184186
export default class Navigation extends Component<
@@ -425,7 +427,9 @@ export default class Navigation extends Component<
425427
return this.renderNavLink(item)
426428
}
427429
})}
428-
{!window._env_.K8S_CLIENT && !this.props.isAirgapped && this.props.serverMode !== SERVER_MODE.EA_ONLY && (
430+
{!window._env_.K8S_CLIENT && !this.props.isAirgapped && (
431+
this.props.serverMode !== SERVER_MODE.EA_ONLY || this.props.currentServerInfo.serverInfo?.installationType !== 'enterprise'
432+
) && (
429433
<>
430434
<div className="short-nav__divider" />
431435
{this.renderNavLink(NavigationStack, 'short-nav__stack-manager')}

src/components/common/navigation/NavigationRoutes.tsx

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import {
3030
MODES,
3131
DEVTRON_BASE_MAIN_ID,
3232
} from '@devtron-labs/devtron-fe-common-lib'
33-
import { Route, Switch, useRouteMatch, useHistory, useLocation, Redirect } from 'react-router-dom'
33+
import { Route, Switch, useRouteMatch, useHistory, useLocation } from 'react-router-dom'
3434
import * as Sentry from '@sentry/browser'
3535
import ReactGA from 'react-ga4'
3636
import TagManager from 'react-gtm-module'
@@ -384,6 +384,7 @@ export default function NavigationRoutes() {
384384
<main className={_isOnboardingPage ? 'no-nav' : ''} id={DEVTRON_BASE_MAIN_ID}>
385385
{!_isOnboardingPage && (
386386
<Navigation
387+
currentServerInfo={currentServerInfo}
387388
history={history}
388389
match={match}
389390
location={location}
@@ -421,7 +422,6 @@ export default function NavigationRoutes() {
421422
isSuperAdmin={isSuperAdmin}
422423
appListCount={appListCount}
423424
loginCount={loginCount}
424-
serverMode={serverMode}
425425
/>
426426
)}
427427
/>,
@@ -482,7 +482,7 @@ export default function NavigationRoutes() {
482482
</Route>,
483483
]
484484
: []),
485-
...(serverMode !== SERVER_MODE.EA_ONLY
485+
...(serverMode !== SERVER_MODE.EA_ONLY || currentServerInfo.serverInfo?.installationType !== 'enterprise'
486486
? [
487487
<Route key={URLS.STACK_MANAGER} path={URLS.STACK_MANAGER}>
488488
<DevtronStackManager
@@ -525,7 +525,7 @@ export default function NavigationRoutes() {
525525
)
526526
}
527527

528-
export const AppRouter = ({ isSuperAdmin, appListCount, loginCount, serverMode }: AppRouterType) => {
528+
export const AppRouter = ({ isSuperAdmin, appListCount, loginCount }: AppRouterType) => {
529529
const { path } = useRouteMatch()
530530
const [environmentId, setEnvironmentId] = useState(null)
531531
const [currentAppName, setCurrentAppName] = useState<string>('')
@@ -541,7 +541,6 @@ export const AppRouter = ({ isSuperAdmin, appListCount, loginCount, serverMode }
541541
isSuperAdmin={isSuperAdmin}
542542
appListCount={appListCount}
543543
loginCount={loginCount}
544-
serverMode={serverMode}
545544
/>
546545
)}
547546
/>
@@ -563,11 +562,7 @@ export const AppRouter = ({ isSuperAdmin, appListCount, loginCount, serverMode }
563562
<Route path={`${path}/v2/:appId(\\d+)`} render={() => <AppDetailsPage isV2 />} />
564563

565564
<Route exact path="">
566-
{serverMode === SERVER_MODE.EA_ONLY ? (
567-
<Redirect to={URLS.RESOURCE_BROWSER} />
568-
) : (
569-
<RedirectToAppList />
570-
)}
565+
<RedirectToAppList />
571566
</Route>
572567
<Route>
573568
<RedirectUserWithSentry
@@ -580,21 +575,17 @@ export const AppRouter = ({ isSuperAdmin, appListCount, loginCount, serverMode }
580575
)
581576
}
582577

583-
export const AppListRouter = ({ isSuperAdmin, appListCount, loginCount, serverMode }: AppRouterType) => {
578+
export const AppListRouter = ({ isSuperAdmin, appListCount, loginCount }: AppRouterType) => {
584579
const { path } = useRouteMatch()
585580
const [, argoInfoData] = useAsync(() => getModuleInfo(ModuleNameMap.ARGO_CD))
586581
const isArgoInstalled: boolean = argoInfoData?.result?.status === ModuleStatus.INSTALLED
587582

588583
return (
589584
<ErrorBoundary>
590585
<Switch>
591-
<Route exact path={`${path}/:appType`} render={() => <NewAppList isArgoInstalled={isArgoInstalled} />} />
586+
<Route path={`${path}/:appType`} render={() => <NewAppList isArgoInstalled={isArgoInstalled} />} />
592587
<Route exact path="">
593-
{serverMode === SERVER_MODE.EA_ONLY ? (
594-
<Redirect to={URLS.RESOURCE_BROWSER} />
595-
) : (
596-
<RedirectToAppList />
597-
)}
588+
<RedirectToAppList />
598589
</Route>
599590
<Route>
600591
<RedirectUserWithSentry isFirstLoginUser={isSuperAdmin && loginCount === 0 && appListCount === 0} />
@@ -624,6 +615,8 @@ export const RedirectUserWithSentry = ({ isFirstLoginUser }) => {
624615
push(URLS.RESOURCE_BROWSER)
625616
} else if (isFirstLoginUser) {
626617
push(URLS.GETTING_STARTED)
618+
} else if (window._env_.FEATURE_DEFAULT_LANDING_RB_ENABLE) {
619+
push(URLS.RESOURCE_BROWSER)
627620
} else {
628621
push(`${URLS.APP}/${URLS.APP_LIST}`)
629622
}

src/components/login/Login.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class Login extends Component<LoginProps, LoginFormState> {
151151
return CommonURL.NETWORK_STATUS_INTERFACE
152152
}
153153

154-
return URLS.APP
154+
return window._env_.FEATURE_DEFAULT_LANDING_RB_ENABLE ? URLS.RESOURCE_BROWSER : URLS.APP
155155
}
156156

157157
login(e): void {

src/services/service.types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ export interface AppRouterType {
140140
isSuperAdmin?: boolean
141141
appListCount: number
142142
loginCount: number
143-
serverMode: SERVER_MODE
144143
}
145144

146145
export interface ConfigOverrideWorkflowDetails {

0 commit comments

Comments
 (0)