@@ -39,6 +39,7 @@ export function ListJobsTable(props: IListJobsTableProps): JSX.Element {
3939 const [ deletedRows , setDeletedRows ] = useState <
4040 Set < Scheduler . IDescribeJob [ 'job_id' ] >
4141 > ( new Set ( ) ) ;
42+
4243 const trans = useTranslator ( 'jupyterlab' ) ;
4344
4445 // Cache environment list — we need this for the output formats.
@@ -185,7 +186,10 @@ function ListJobDefinitionsTable(props: ListJobDefinitionsTableProps) {
185186 const [ deletedRows , setDeletedRows ] = useState <
186187 Set < Scheduler . IDescribeJobDefinition [ 'job_definition_id' ] >
187188 > ( new Set ( ) ) ;
188- const [ displayError , setDisplayError ] = useState < string | null > ( null ) ;
189+
190+ const [ displayError , setDisplayError ] = useState < React . ReactNode | null > (
191+ null
192+ ) ;
189193
190194 const api = useMemo ( ( ) => new SchedulerService ( { } ) , [ ] ) ;
191195
@@ -264,7 +268,11 @@ function ListJobDefinitionsTable(props: ListJobDefinitionsTableProps) {
264268
265269 return (
266270 < >
267- { displayError && < Alert severity = "error" > { displayError } </ Alert > }
271+ { displayError && (
272+ < Alert severity = "error" onClose = { ( ) => setDisplayError ( null ) } >
273+ { displayError }
274+ </ Alert >
275+ ) }
268276 { reloadButton }
269277 < AdvancedTable
270278 query = { jobDefsQuery }
@@ -289,6 +297,8 @@ export interface IListJobsProps {
289297 showCreateJob : ( newModel : ICreateJobModel ) => void ;
290298 showJobDetail : ( jobId : string ) => void ;
291299 showJobDefinitionDetail : ( jobDefId : string ) => void ;
300+ newlyCreatedId ?: string ;
301+ newlyCreatedName ?: string ;
292302}
293303
294304export function NotebookJobsList ( props : IListJobsProps ) : JSX . Element {
@@ -300,6 +310,26 @@ export function NotebookJobsList(props: IListJobsProps): JSX.Element {
300310 [ trans ]
301311 ) ;
302312
313+ // Display creation message
314+ const successMessage =
315+ props . newlyCreatedId !== undefined && props . newlyCreatedName !== undefined
316+ ? props . listView === JobsView . ListJobs
317+ ? trans . __ (
318+ 'Your job "%1" has been created. ' +
319+ 'If you do not see it in the list below, please reload the list in a few seconds.' ,
320+ props . newlyCreatedName
321+ )
322+ : trans . __ (
323+ 'Your job definition "%1" has been created. ' +
324+ 'If you do not see it in the list below, please reload the list in a few seconds.' ,
325+ props . newlyCreatedName
326+ )
327+ : null ;
328+
329+ const [ displayInfo , setDisplayInfo ] = useState < React . ReactNode | null > (
330+ successMessage
331+ ) ;
332+
303333 // Retrieve the initial jobs list
304334 return (
305335 < Box sx = { { p : 4 } } style = { { height : '100%' , boxSizing : 'border-box' } } >
@@ -317,6 +347,11 @@ export function NotebookJobsList(props: IListJobsProps): JSX.Element {
317347 value = { JobsView . ListJobDefinitions }
318348 />
319349 </ Tabs >
350+ { displayInfo && (
351+ < Alert severity = "info" onClose = { ( ) => setDisplayInfo ( null ) } >
352+ { displayInfo }
353+ </ Alert >
354+ ) }
320355 { props . listView === JobsView . ListJobs && (
321356 < >
322357 < Heading level = { 1 } > { jobsHeader } </ Heading >
0 commit comments