Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: user can open a session detail panel in notifications #2858

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion react/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -147,7 +148,10 @@ const router = createBrowserRouter([
children: [
{
path: '',
element: <WebUINavigate to="/job" replace />,
Component: () => {
const location = useLocation();
return <WebUINavigate to={'/job' + location.search} replace />;
},
},
{
path: '/session/start',
Expand Down
16 changes: 8 additions & 8 deletions react/src/components/WebUINavigate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<WebUINavigateProps> = ({ options, ...props }) => {
interface WebUINavigateProps extends NavigateProps {}
const WebUINavigate: React.FC<WebUINavigateProps> = ({ ...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,
},
}),
);
Expand Down
5 changes: 5 additions & 0 deletions react/src/pages/SessionLauncherPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading