@@ -33,9 +33,13 @@ export default class BoardConfiguration {
33
33
this . daemon = daemon ;
34
34
this . serialMonitorContent = '' ;
35
35
this . configuring = new BehaviorSubject ( { status : this . CONFIGURE_NOPE } ) ;
36
- this . configureDone = this . configuring . pipe ( filter ( configure => configure . status === this . CONFIGURE_DONE ) ) ;
36
+ this . configureDone = this . configuring . pipe ( filter ( configure => configure . status === this . CONFIGURE_DONE ) )
37
+ . pipe ( first ( ) )
38
+ . pipe ( takeUntil ( this . configuring . pipe ( filter ( configure => configure . status === this . CONFIGURE_ERROR ) ) ) ) ;
39
+ this . configureError = this . configuring . pipe ( filter ( configure => configure . status === this . CONFIGURE_ERROR ) )
40
+ . pipe ( first ( ) )
41
+ . pipe ( takeUntil ( this . configureDone ) ) ;
37
42
this . configureInProgress = this . configuring . pipe ( filter ( configure => configure . status === this . CONFIGURE_IN_PROGRESS ) ) ;
38
- this . configureError = this . configuring . pipe ( filter ( configure => configure . status === this . CONFIGURE_ERROR ) ) ;
39
43
this . daemon . serialMonitorMessages . subscribe ( message => {
40
44
this . serialMonitorContent += message ;
41
45
} ) ;
@@ -45,8 +49,8 @@ export default class BoardConfiguration {
45
49
this . configuring . next ( { status : this . CONFIGURE_IN_PROGRESS , msg : 'Starting board configuration...' } ) ;
46
50
}
47
51
48
- notifyError ( msg ) {
49
- this . configuring . next ( { status : this . CONFIGURE_ERROR , msg : msg , err : msg } ) ;
52
+ notifyError ( err , msg ) {
53
+ this . configuring . next ( { status : this . CONFIGURE_ERROR , err , msg } ) ;
50
54
}
51
55
52
56
/**
@@ -189,7 +193,7 @@ export default class BoardConfiguration {
189
193
return ;
190
194
}
191
195
192
- this . daemon . uploadingDone . pipe ( first ( ) ) . subscribe ( ( ) => {
196
+ this . daemon . uploadingDone . subscribe ( ( ) => {
193
197
this . configuring . next ( {
194
198
status : this . CONFIGURE_IN_PROGRESS ,
195
199
msg : 'Provisioning sketch uploaded successfully. Opening serial monitor...'
@@ -206,7 +210,7 @@ export default class BoardConfiguration {
206
210
status : this . CONFIGURE_IN_PROGRESS ,
207
211
msg : 'CSR generated. Creating device...'
208
212
} ) ;
209
- return createDeviceCb ( csr )
213
+ return createDeviceCb ( csr ) ;
210
214
} )
211
215
. then ( data => {
212
216
this . configuring . next ( {
@@ -230,10 +234,10 @@ export default class BoardConfiguration {
230
234
err : error . toString ( )
231
235
} ) ;
232
236
} ) ;
233
- this . daemon . openSerialMonitor ( board . port , BAUDRATE ) ;
237
+ this . daemon . openSerialMonitor ( board . port , BAUDRATE ) ;
234
238
} ) ;
235
239
236
- this . daemon . uploadingError . pipe ( first ( ) ) . subscribe ( upload => {
240
+ this . daemon . uploadingError . subscribe ( upload => {
237
241
this . configuring . next ( { status : this . CONFIGURE_ERROR , err : `Couldn't configure board at port ${ board . port } . Upload failed with error: ${ upload . err } ` } ) ;
238
242
} ) ;
239
243
0 commit comments