File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717import { toast } from 'react-toastify' ;
1818import { requestAPI } from '../handler/Handler' ;
1919import { SchedulerLoggingService , LOG_LEVEL } from './LoggingService' ;
20- import { showToast , toastifyCustomStyle } from '../utils/Config' ;
20+ import {
21+ showToast ,
22+ toastifyCustomStyle ,
23+ toastifyCustomWidth
24+ } from '../utils/Config' ;
2125import {
2226 ICreatePayload ,
2327 IVertexScheduleList ,
@@ -98,10 +102,28 @@ export class VertexServices {
98102 method : 'POST'
99103 } ) ;
100104 if ( data . error ) {
101- toast . error (
102- < ExpandToastMessage message = { data . error } /> ,
103- toastifyCustomStyle
105+ const jsonstr = data ? .error . slice (
106+ data ? .error . indexOf ( '{' ) ,
107+ data ?. error . lastIndexOf ( '}' ) + 1
104108 ) ;
109+ if ( jsonstr ) {
110+ const errorObject = JSON . parse ( jsonstr ) ;
111+ if ( errorObject . error . message ) {
112+ toast . error (
113+ `Error in creating schedule : ${ errorObject . error . message } ` ,
114+ {
115+ ...toastifyCustomStyle
116+ }
117+ ) ;
118+ } else {
119+ toast . error (
120+ < ExpandToastMessage message = { data . error } /> ,
121+ data . error . length > 500
122+ ? toastifyCustomWidth
123+ : toastifyCustomStyle
124+ ) ;
125+ }
126+ }
105127 setCreatingVertexScheduler ( false ) ;
106128 } else {
107129 toast . success (
Original file line number Diff line number Diff line change @@ -76,6 +76,16 @@ export const toastifyCustomStyle: ToastOptions<Record<string, never>> = {
7676 position : toast . POSITION . BOTTOM_CENTER
7777} ;
7878
79+ export const toastifyCustomWidth : ToastOptions < Record < string , never > > = {
80+ hideProgressBar : true ,
81+ autoClose : 600000 ,
82+ theme : 'dark' ,
83+ position : toast . POSITION . BOTTOM_CENTER ,
84+ style : {
85+ width : '150%'
86+ }
87+ } ;
88+
7989export const handleDebounce = ( func : any , delay : number ) => {
8090 let timeoutId : any ;
8191 return function ( ...args : any ) {
You can’t perform that action at this time.
0 commit comments