@@ -103,6 +103,42 @@ export default function QueueTaskModal({
103103 ) ;
104104 const [ sweepMetric , setSweepMetric ] = React . useState ( 'eval/loss' ) ;
105105 const [ lowerIsBetter , setLowerIsBetter ] = React . useState ( true ) ;
106+ const loadingMessages = React . useMemo (
107+ ( ) => [
108+ 'Contacting compute provider…' ,
109+ 'Reserving resources…' ,
110+ 'Preparing environment…' ,
111+ 'Submitting job configuration…' ,
112+ 'Waiting for job ID…' ,
113+ ] ,
114+ [ ] ,
115+ ) ;
116+ const [ loadingMessageIndex , setLoadingMessageIndex ] = React . useState ( 0 ) ;
117+
118+ React . useEffect ( ( ) => {
119+ if ( ! open || ! isSubmitting || loadingMessages . length === 0 ) {
120+ return ;
121+ }
122+
123+ // Reset to first message whenever a new submission starts
124+ setLoadingMessageIndex ( 0 ) ;
125+
126+ const interval = window . setInterval ( ( ) => {
127+ setLoadingMessageIndex ( ( prev ) => {
128+ const lastIndex = loadingMessages . length - 1 ;
129+ // Once we reach the final message ("Waiting for job ID…"),
130+ // stay there instead of looping back to the beginning.
131+ if ( prev >= lastIndex ) {
132+ return lastIndex ;
133+ }
134+ return prev + 1 ;
135+ } ) ;
136+ } , 1500 ) ;
137+
138+ return ( ) => {
139+ window . clearInterval ( interval ) ;
140+ } ;
141+ } , [ open , isSubmitting , loadingMessages ] ) ;
106142
107143 // Fetch available models and datasets from the API
108144 const { data : modelsData } = useSWR (
@@ -1170,6 +1206,11 @@ export default function QueueTaskModal({
11701206 >
11711207 Submit
11721208 </ Button >
1209+ { isSubmitting && (
1210+ < Typography level = "body-sm" sx = { { ml : 1 } } >
1211+ { loadingMessages [ loadingMessageIndex ] }
1212+ </ Typography >
1213+ ) }
11731214 </ DialogActions >
11741215 </ ModalDialog >
11751216 </ Modal >
0 commit comments