@@ -18,11 +18,20 @@ import {
1818 Row ,
1919 Typography ,
2020} from 'antd' ;
21- import { BAIFlex , BAIModal , BAISelect , BAIText } from 'backend.ai-ui' ;
21+ import {
22+ BAIButton ,
23+ BAIFlex ,
24+ BAILink ,
25+ BAIModal ,
26+ BAISelect ,
27+ BAIText ,
28+ } from 'backend.ai-ui' ;
2229import _ from 'lodash' ;
2330import { useRef , useState } from 'react' ;
2431import { Trans , useTranslation } from 'react-i18next' ;
2532import { graphql , useFragment } from 'react-relay' ;
33+ import { useNavigate } from 'react-router-dom' ;
34+ import { useSetBAINotification } from 'src/hooks/useBAINotification' ;
2635
2736interface AppLauncherModalProps extends ModalProps {
2837 onRequestClose : ( ) => void ;
@@ -43,6 +52,9 @@ const AppLauncherModal: React.FC<AppLauncherModalProps> = ({
4352 const [ forceUseV2Proxy , setForceUseV2Proxy ] = useState < boolean > ( false ) ;
4453 const [ useSubDomain , setUseSubDomain ] = useState < boolean > ( false ) ;
4554
55+ const { upsertNotification } = useSetBAINotification ( ) ;
56+ const navigate = useNavigate ( ) ;
57+
4658 const session = useFragment (
4759 graphql `
4860 fragment AppLauncherModalFragment on ComputeSessionNode {
@@ -92,9 +104,38 @@ const AppLauncherModal: React.FC<AppLauncherModalProps> = ({
92104 }
93105 } ) ;
94106
107+ // set notification for lit-element component
108+ upsertNotification ( {
109+ key : `session-app-${ session ?. row_id } ` ,
110+ message : (
111+ < span >
112+ { t ( 'general.Session' ) } :
113+ < BAILink
114+ style = { {
115+ fontWeight : 'normal' ,
116+ } }
117+ onClick = { ( ) => {
118+ const newSearchParams = new URLSearchParams ( location . search ) ;
119+ newSearchParams . set ( 'sessionDetail' , session ?. row_id || '' ) ;
120+ navigate ( {
121+ pathname : `/session` ,
122+ search : newSearchParams . toString ( ) ,
123+ } ) ;
124+ } }
125+ >
126+ { session ?. name }
127+ </ BAILink >
128+ </ span >
129+ ) ,
130+ description : t ( 'session.appLauncher.LaunchingApp' , {
131+ appName : app ?. title || '' ,
132+ } ) ,
133+ } ) ;
134+
95135 const appController = {
96136 'app-name' : app ?. name ?? '' ,
97137 'session-uuid' : session ?. row_id ?? '' ,
138+ 'session-name' : session ?. name ?? '' ,
98139 'url-postfix' : app ?. redirect ?? '' ,
99140 } ;
100141
@@ -121,10 +162,7 @@ const AppLauncherModal: React.FC<AppLauncherModalProps> = ({
121162 return ;
122163 }
123164 // @ts -ignore
124- globalThis . appLauncher . _runApp ( appController ) . then ( ( ) => { } ) ;
125- setOpenToPublic ( false ) ;
126- setTryPreferredPort ( false ) ;
127- onRequestClose ( ) ;
165+ await globalThis . appLauncher . _runApp ( appController ) . then ( ( ) => { } ) ;
128166 } ;
129167
130168 return (
@@ -166,7 +204,7 @@ const AppLauncherModal: React.FC<AppLauncherModalProps> = ({
166204 gap = { 'xs' }
167205 style = { { height : '100%' } }
168206 >
169- < Button
207+ < BAIButton
170208 icon = {
171209 < Image
172210 src = { app ?. src }
@@ -175,8 +213,12 @@ const AppLauncherModal: React.FC<AppLauncherModalProps> = ({
175213 style = { { height : 36 , width : 36 } }
176214 />
177215 }
178- onClick = { ( ) => {
179- handleAppLaunch ( app ) ;
216+ action = { async ( ) => {
217+ await handleAppLaunch ( app ) . then ( ( ) => {
218+ setOpenToPublic ( false ) ;
219+ setTryPreferredPort ( false ) ;
220+ onRequestClose ( ) ;
221+ } ) ;
180222 } }
181223 style = { { height : 72 , width : 72 } }
182224 />
0 commit comments