@@ -68,71 +68,85 @@ class GraphServer extends GraphLoadSave {
6868
6969 build ( ) {
7070 // TODO
71+ this . dispatcher ( { type : T . SET_LOADER , payload : true } ) ;
7172 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 } ` )
7273 . then ( ( res ) => { // eslint-disable-next-line
7374 toast . success ( res . data [ 'message' ] )
75+ this . dispatcher ( { type : T . SET_LOADER , payload : false } ) ;
7476 } ) . catch ( ( err ) => { // eslint-disable-next-line
75- toast . success ( err ) ;
77+ toast . error ( err . message ) ;
78+ this . dispatcher ( { type : T . SET_LOADER , payload : false } ) ;
7679 } ) ;
7780 if ( this . serverID ) ;
7881 }
7982
8083 debug ( ) {
8184 // TODO
85+ this . dispatcher ( { type : T . SET_LOADER , payload : true } ) ;
8286 Axios . post ( `http://127.0.0.1:5000/debug/${ this . superState . graphs [ this . superState . curGraphIndex ] . fileName . split ( '.' ) [ 0 ] } ` )
8387 . then ( ( res ) => { // eslint-disable-next-line
8488 toast . success ( res . data [ 'message' ] )
89+ this . dispatcher ( { type : T . SET_LOADER , payload : false } ) ;
8590 } ) . catch ( ( err ) => { // eslint-disable-next-line
86- toast . success ( err ) ;
91+ toast . error ( err . message ) ;
92+ this . dispatcher ( { type : T . SET_LOADER , payload : false } ) ;
8793 } ) ;
8894 if ( this . serverID ) ;
8995 }
9096
9197 run ( ) {
9298 // TODO
99+ this . dispatcher ( { type : T . SET_LOADER , payload : true } ) ;
93100 Axios . post ( `http://127.0.0.1:5000/run/${ this . superState . graphs [ this . superState . curGraphIndex ] . fileName . split ( '.' ) [ 0 ] } ` )
94101 . then ( ( res ) => { // eslint-disable-next-line
95102 toast . success ( res . data [ 'message' ] )
103+ this . dispatcher ( { type : T . SET_LOADER , payload : false } ) ;
96104 } ) . catch ( ( err ) => { // eslint-disable-next-line
97- toast . success ( err ) ;
105+ toast . error ( err . message ) ;
106+ this . dispatcher ( { type : T . SET_LOADER , payload : false } ) ;
98107 } ) ;
99108 if ( this . serverID ) ;
100109 }
101110
102111 clear ( ) {
103112 // TODO
113+ this . dispatcher ( { type : T . SET_LOADER , payload : true } ) ;
104114 Axios . post ( `http://127.0.0.1:5000/clear/${ this . superState . graphs [ this . superState . curGraphIndex ] . fileName . split ( '.' ) [ 0 ] }
105115 ?unlock=${ this . superState . unlockCheck } &maxtime=${ this . superState . maxTime } ¶ms=${ this . superState . params } ` )
106116 . then ( ( res ) => { // eslint-disable-next-line
107117 toast . success ( res . data [ 'message' ] ) ;
108- // console.log(this.superState.dockerCheck);
109- // console.log(this.superState.unlockCheck);
110- // console.log(this.superState.maxTime);
111- // console.log(this.superState.params);
118+ this . dispatcher ( { type : T . SET_LOADER , payload : false } ) ;
112119 } ) . catch ( ( err ) => { // eslint-disable-next-line
113- toast . success ( err ) ;
120+ toast . error ( err . message ) ;
121+ this . dispatcher ( { type : T . SET_LOADER , payload : false } ) ;
114122 } ) ;
115123 if ( this . serverID ) ;
116124 }
117125
118126 stop ( ) {
119127 // TODO
128+ this . dispatcher ( { type : T . SET_LOADER , payload : true } ) ;
120129 Axios . post ( `http://127.0.0.1:5000/stop/${ this . superState . graphs [ this . superState . curGraphIndex ] . fileName . split ( '.' ) [ 0 ] } ` )
121130 . then ( ( res ) => { // eslint-disable-next-line
122131 toast . success ( res . data [ 'message' ] )
132+ this . dispatcher ( { type : T . SET_LOADER , payload : false } ) ;
123133 } ) . catch ( ( err ) => { // eslint-disable-next-line
124- toast . success ( err ) ;
134+ toast . error ( err . message ) ;
135+ this . dispatcher ( { type : T . SET_LOADER , payload : false } ) ;
125136 } ) ;
126137 if ( this . serverID ) ;
127138 }
128139
129140 destroy ( ) {
130141 // TODO
142+ this . dispatcher ( { type : T . SET_LOADER , payload : true } ) ;
131143 Axios . delete ( `http://127.0.0.1:5000/destroy/${ this . superState . graphs [ this . superState . curGraphIndex ] . fileName . split ( '.' ) [ 0 ] } ` )
132144 . then ( ( res ) => { // eslint-disable-next-line
133145 toast . success ( res . data [ 'message' ] )
146+ this . dispatcher ( { type : T . SET_LOADER , payload : false } ) ;
134147 } ) . catch ( ( err ) => { // eslint-disable-next-line
135- toast . success ( err ) ;
148+ toast . error ( err . message ) ;
149+ this . dispatcher ( { type : T . SET_LOADER , payload : false } ) ;
136150 } ) ;
137151 if ( this . serverID ) ;
138152 }
0 commit comments