Skip to content

Commit

Permalink
fix: add support route to the base route for private routes (#6688)
Browse files Browse the repository at this point in the history
* fix: add support route to the base route for private routes

* fix: early return from useEffect if it's an old route

* fix: same old explorer routes in old mapping
  • Loading branch information
vikrantgupta25 authored Dec 20, 2024
1 parent 2f62a9d commit 2c2e248
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 3 additions & 1 deletion frontend/src/AppRoutes/Private.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import routes, {
LIST_LICENSES,
oldNewRoutesMapping,
oldRoutes,
SUPPORT_ROUTE,
} from './routes';

function PrivateRoute({ children }: PrivateRouteProps): JSX.Element {
Expand All @@ -37,7 +38,7 @@ function PrivateRoute({ children }: PrivateRouteProps): JSX.Element {
const mapRoutes = useMemo(
() =>
new Map(
[...routes, LIST_LICENSES].map((e) => {
[...routes, LIST_LICENSES, SUPPORT_ROUTE].map((e) => {
const currentPath = matchPath(pathname, {
path: e.path,
});
Expand Down Expand Up @@ -160,6 +161,7 @@ function PrivateRoute({ children }: PrivateRouteProps): JSX.Element {
pathname: redirectUrl,
};
history.replace(newLocation);
return;
}
// if the current route
if (currentRoute) {
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/AppRoutes/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,6 @@ export const LIST_LICENSES: AppRoutes = {

export const oldRoutes = [
'/pipelines',
'/logs/old-logs-explorer',
'/logs-explorer',
'/logs-explorer/live',
'/logs-save-views',
Expand All @@ -437,7 +436,6 @@ export const oldRoutes = [

export const oldNewRoutesMapping: Record<string, string> = {
'/pipelines': '/logs/pipelines',
'/logs/old-logs-explorer': '/logs/old-logs-explorer',
'/logs-explorer': '/logs/logs-explorer',
'/logs-explorer/live': '/logs/logs-explorer/live',
'/logs-save-views': '/logs/saved-views',
Expand Down

0 comments on commit 2c2e248

Please sign in to comment.