@@ -68,7 +68,10 @@ class GraphServer extends GraphLoadSave {
6868
6969 build ( ) {
7070 // TODO
71- this . dispatcher ( { type : T . SET_LOADER , payload : true } ) ;
71+ const toastId = toast . info ( 'LOADING.......' , {
72+ position : 'bottom-left' ,
73+ autoClose : false , // Disable auto-close
74+ } ) ;
7275 Axios . post ( `http://127.0.0.1:5000/build/${ this . superState . uploadedDirName } ?fetch=${ this . superState . graphs [ this . superState . curGraphIndex ] . fileName . split ( '.' ) [ 0 ] } &unlock=${ this . superState . unlockCheck } &docker=${ this . superState . dockerCheck } &maxtime=${ this . superState . maxTime } ¶ms=${ this . superState . params } &octave=${ this . superState . octave } ` )
7376 . then ( ( res ) => { // eslint-disable-next-line
7477 toast . success ( res . data [ 'message' ] )
@@ -78,17 +81,20 @@ class GraphServer extends GraphLoadSave {
7881 built : false , ran : false , debugged : true , cleared : false , stopped : false , destroyed : true ,
7982 } ,
8083 } ) ;
81- this . dispatcher ( { type : T . SET_LOADER , payload : false } ) ;
84+ toast . dismiss ( toastId ) ;
8285 } ) . catch ( ( err ) => { // eslint-disable-next-line
8386 toast . error ( err . message ) ;
84- this . dispatcher ( { type : T . SET_LOADER , payload : false } ) ;
87+ toast . dismiss ( toastId ) ;
8588 } ) ;
8689 if ( this . serverID ) ;
8790 }
8891
8992 debug ( ) {
9093 // TODO
91- this . dispatcher ( { type : T . SET_LOADER , payload : true } ) ;
94+ const toastId = toast . info ( 'LOADING.......' , {
95+ position : 'bottom-left' ,
96+ autoClose : false , // Disable auto-close
97+ } ) ;
9298 Axios . post ( `http://127.0.0.1:5000/debug/${ this . superState . graphs [ this . superState . curGraphIndex ] . fileName . split ( '.' ) [ 0 ] } ` )
9399 . then ( ( res ) => { // eslint-disable-next-line
94100 toast . success ( res . data [ 'message' ] )
@@ -98,17 +104,20 @@ class GraphServer extends GraphLoadSave {
98104 built : false , ran : false , debugged : false , cleared : true , stopped : true , destroyed : true ,
99105 } ,
100106 } ) ;
101- this . dispatcher ( { type : T . SET_LOADER , payload : false } ) ;
107+ toast . dismiss ( toastId ) ;
102108 } ) . catch ( ( err ) => { // eslint-disable-next-line
103109 toast . error ( err . message ) ;
104- this . dispatcher ( { type : T . SET_LOADER , payload : false } ) ;
110+ toast . dismiss ( toastId ) ;
105111 } ) ;
106112 if ( this . serverID ) ;
107113 }
108114
109115 run ( ) {
110116 // TODO
111- this . dispatcher ( { type : T . SET_LOADER , payload : true } ) ;
117+ const toastId = toast . info ( 'LOADING.......' , {
118+ position : 'bottom-left' ,
119+ autoClose : false , // Disable auto-close
120+ } ) ;
112121 Axios . post ( `http://127.0.0.1:5000/run/${ this . superState . graphs [ this . superState . curGraphIndex ] . fileName . split ( '.' ) [ 0 ] } ` )
113122 . then ( ( res ) => { // eslint-disable-next-line
114123 toast . success ( res . data [ 'message' ] )
@@ -118,17 +127,20 @@ class GraphServer extends GraphLoadSave {
118127 built : false , ran : false , debugged : false , cleared : true , stopped : true , destroyed : true ,
119128 } ,
120129 } ) ;
121- this . dispatcher ( { type : T . SET_LOADER , payload : false } ) ;
130+ toast . dismiss ( toastId ) ;
122131 } ) . catch ( ( err ) => { // eslint-disable-next-line
123132 toast . error ( err . message ) ;
124- this . dispatcher ( { type : T . SET_LOADER , payload : false } ) ;
133+ toast . dismiss ( toastId ) ;
125134 } ) ;
126135 if ( this . serverID ) ;
127136 }
128137
129138 clear ( ) {
130139 // TODO
131- this . dispatcher ( { type : T . SET_LOADER , payload : true } ) ;
140+ const toastId = toast . info ( 'LOADING.......' , {
141+ position : 'bottom-left' ,
142+ autoClose : false , // Disable auto-close
143+ } ) ;
132144 Axios . post ( `http://127.0.0.1:5000/clear/${ this . superState . graphs [ this . superState . curGraphIndex ] . fileName . split ( '.' ) [ 0 ] }
133145 ?unlock=${ this . superState . unlockCheck } &maxtime=${ this . superState . maxTime } ¶ms=${ this . superState . params } ` )
134146 . then ( ( res ) => { // eslint-disable-next-line
@@ -139,17 +151,20 @@ class GraphServer extends GraphLoadSave {
139151 built : false , ran : true , debugged : true , cleared : false , stopped : true , destroyed : true ,
140152 } ,
141153 } ) ;
142- this . dispatcher ( { type : T . SET_LOADER , payload : false } ) ;
154+ toast . dismiss ( toastId ) ;
143155 } ) . catch ( ( err ) => { // eslint-disable-next-line
144156 toast . error ( err . message ) ;
145- this . dispatcher ( { type : T . SET_LOADER , payload : false } ) ;
157+ toast . dismiss ( toastId ) ;
146158 } ) ;
147159 if ( this . serverID ) ;
148160 }
149161
150162 stop ( ) {
151163 // TODO
152- this . dispatcher ( { type : T . SET_LOADER , payload : true } ) ;
164+ const toastId = toast . info ( 'LOADING.......' , {
165+ position : 'bottom-left' ,
166+ autoClose : false , // Disable auto-close
167+ } ) ;
153168 Axios . post ( `http://127.0.0.1:5000/stop/${ this . superState . graphs [ this . superState . curGraphIndex ] . fileName . split ( '.' ) [ 0 ] } ` )
154169 . then ( ( res ) => { // eslint-disable-next-line
155170 toast . success ( res . data [ 'message' ] )
@@ -159,17 +174,20 @@ class GraphServer extends GraphLoadSave {
159174 built : false , ran : false , debugged : false , cleared : true , stopped : false , destroyed : true ,
160175 } ,
161176 } ) ;
162- this . dispatcher ( { type : T . SET_LOADER , payload : false } ) ;
177+ toast . dismiss ( toastId ) ;
163178 } ) . catch ( ( err ) => { // eslint-disable-next-line
164179 toast . error ( err . message ) ;
165- this . dispatcher ( { type : T . SET_LOADER , payload : false } ) ;
180+ toast . dismiss ( toastId ) ;
166181 } ) ;
167182 if ( this . serverID ) ;
168183 }
169184
170185 destroy ( ) {
171186 // TODO
172- this . dispatcher ( { type : T . SET_LOADER , payload : true } ) ;
187+ const toastId = toast . info ( 'LOADING.......' , {
188+ position : 'bottom-left' ,
189+ autoClose : false , // Disable auto-close
190+ } ) ;
173191 Axios . delete ( `http://127.0.0.1:5000/destroy/${ this . superState . graphs [ this . superState . curGraphIndex ] . fileName . split ( '.' ) [ 0 ] } ` )
174192 . then ( ( res ) => { // eslint-disable-next-line
175193 toast . success ( res . data [ 'message' ] )
@@ -179,10 +197,10 @@ class GraphServer extends GraphLoadSave {
179197 built : true , ran : false , debugged : false , cleared : false , stopped : false , destroyed : false ,
180198 } ,
181199 } ) ;
182- this . dispatcher ( { type : T . SET_LOADER , payload : false } ) ;
200+ toast . dismiss ( toastId ) ;
183201 } ) . catch ( ( err ) => { // eslint-disable-next-line
184202 toast . error ( err . message ) ;
185- this . dispatcher ( { type : T . SET_LOADER , payload : false } ) ;
203+ toast . dismiss ( toastId ) ;
186204 } ) ;
187205 if ( this . serverID ) ;
188206 }
0 commit comments