File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -210,6 +210,20 @@ async function store(state, emitter) {
210
210
emitter . emit ( 'render' )
211
211
} )
212
212
213
+ emitter . on ( 'connect' , async ( ) => {
214
+ try {
215
+ state . availablePorts = await getAvailablePorts ( )
216
+ } catch ( e ) {
217
+ console . error ( 'Could not get available ports. ' , e )
218
+ }
219
+
220
+ if ( state . availablePorts . length == 1 ) {
221
+ emitter . emit ( 'select-port' , state . availablePorts [ 0 ] )
222
+ } else {
223
+ emitter . emit ( 'open-connection-dialog' )
224
+ }
225
+ } )
226
+
213
227
// CODE EXECUTION
214
228
emitter . on ( 'run' , async ( onlySelected = false ) => {
215
229
log ( 'run' )
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ function Toolbar(state, emit) {
16
16
${ Button ( {
17
17
icon : state . isConnected ? 'connect.svg' : 'disconnect.svg' ,
18
18
tooltip : state . isConnected ? `Disconnect (${ metaKeyString } +Shift+D)` : `Connect (${ metaKeyString } +Shift+C)` ,
19
- onClick : ( ) => state . isConnected ? emit ( 'disconnect' ) : emit ( 'open-connection-dialog ' ) ,
19
+ onClick : ( ) => state . isConnected ? emit ( 'disconnect' ) : emit ( 'connect ' ) ,
20
20
active : state . isConnected
21
21
} ) }
22
22
You can’t perform that action at this time.
0 commit comments