@@ -25,6 +25,7 @@ import { renderCellExpand } from '../../component/misc/DataGridExpandRenderer';
25
25
import { getCheckboxes , hasCheckboxes , updateCheckBoxes } from './TableActionsHelper' ;
26
26
import ApiService from '../../utils/apiService' ;
27
27
import { AxiosResponse } from 'axios' ;
28
+ import Notification from '../../component/custom/Notification' ;
28
29
29
30
const TABLE_HEADER_HEIGHT = 32 ;
30
31
const TABLE_FOOTER_HEIGHT = 62 ;
@@ -143,6 +144,13 @@ export const NeoTableChart = (props: ChartProps) => {
143
144
setAnchorEl ( null ) ;
144
145
} ;
145
146
147
+ const [ alertOpen , setAlertOpen ] = React . useState ( false ) ;
148
+ const [ notificationMessage , setNotificationMessage ] = React . useState ( '' ) ;
149
+ const [ notificationSeverity , setNotificationSeverity ] = React . useState < 'success' | 'warning' | 'error' > ( 'success' ) ;
150
+
151
+ const handleNotificationClose = ( ) => {
152
+ setAlertOpen ( false ) ;
153
+ } ;
146
154
const lineBreakColumns : string [ ] = props . settings ?. lineBreaksAfterListEntry ;
147
155
148
156
const actionableFields = actionsRules . filter ( ( r ) => r . condition !== 'rowCheck' ) . map ( ( r ) => r . field ) ;
@@ -335,9 +343,15 @@ export const NeoTableChart = (props: ChartProps) => {
335
343
}
336
344
337
345
props . updateReportSetting ( 'apiSpec' , { ...props . settings ?. apiSpec , response } ) ;
346
+ setNotificationMessage ( 'RUPS package created. Please find the link above' ) ;
347
+ setNotificationSeverity ( 'success' ) ;
348
+ setAlertOpen ( true ) ;
338
349
} catch ( error ) {
339
350
// Handle errors here
340
351
console . error ( 'API call error:' , error ) ;
352
+ setNotificationMessage ( 'RUPS package creation is currently not working. Please try again later.' ) ;
353
+ setNotificationSeverity ( 'error' ) ;
354
+ setAlertOpen ( true ) ;
341
355
} finally {
342
356
setApiLoading ( false ) ;
343
357
}
@@ -401,6 +415,12 @@ export const NeoTableChart = (props: ChartProps) => {
401
415
402
416
return (
403
417
< ThemeProvider theme = { theme } >
418
+ < Notification
419
+ open = { alertOpen }
420
+ message = { notificationMessage }
421
+ severity = { notificationSeverity }
422
+ onClose = { handleNotificationClose }
423
+ />
404
424
{ isApiSpecEnabled ? apiCallButton ( ) : < > </ > }
405
425
< div className = { classes . root } style = { tableStyle } >
406
426
< Snackbar
0 commit comments