diff --git a/react/src/App.tsx b/react/src/App.tsx index 76f96dd88f..646663fae6 100644 --- a/react/src/App.tsx +++ b/react/src/App.tsx @@ -19,6 +19,7 @@ import { IndexRouteObject, RouterProvider, createBrowserRouter, + useLocation, } from 'react-router-dom'; import { QueryParamProvider } from 'use-query-params'; import { ReactRouter6Adapter } from 'use-query-params/adapters/react-router-6'; @@ -147,7 +148,10 @@ const router = createBrowserRouter([ children: [ { path: '', - element: , + Component: () => { + const location = useLocation(); + return ; + }, }, { path: '/session/start', diff --git a/react/src/components/WebUINavigate.tsx b/react/src/components/WebUINavigate.tsx index fa16fa052a..c0bc720ba0 100644 --- a/react/src/components/WebUINavigate.tsx +++ b/react/src/components/WebUINavigate.tsx @@ -3,20 +3,20 @@ import _ from 'lodash'; import React, { useEffect } from 'react'; import { Navigate, NavigateProps } from 'react-router-dom'; -interface WebUINavigateProps extends NavigateProps { - options?: { - params?: any; - }; -} -const WebUINavigate: React.FC = ({ options, ...props }) => { +interface WebUINavigateProps extends NavigateProps {} +const WebUINavigate: React.FC = ({ ...props }) => { useSuspendedBackendaiClient(); const pathName = _.isString(props.to) ? props.to : props.to.pathname || ''; + const [path, query] = pathName.split('?'); + const params = { + params: Object.fromEntries(new URLSearchParams(query)), + }; useEffect(() => { document.dispatchEvent( new CustomEvent('move-to-from-react', { detail: { - path: pathName, - params: options?.params, + path: path, + params, }, }), ); diff --git a/react/src/pages/SessionLauncherPage.tsx b/react/src/pages/SessionLauncherPage.tsx index 636c13842c..d9ee21e591 100644 --- a/react/src/pages/SessionLauncherPage.tsx +++ b/react/src/pages/SessionLauncherPage.tsx @@ -606,6 +606,11 @@ const SessionLauncherPage = () => { sessionName: string; servicePorts: Array<{ name: string }>; }>) => { + // After the session is created, add a "See Details" button to navigate to the session page. + upsertNotification({ + key: 'session-launcher:' + sessionName, + to: `/session?sessionDetail=${firstSession.sessionId}`, + }); pushSessionHistory({ id: firstSession.sessionId, params: usedSearchParams,