@@ -329,6 +329,10 @@ class DiscoveryModal extends GenericModal {
329329 let ip = this . _currentModal . querySelector ( "#ip" ) ;
330330 ip . href = `http://${ deviceInfo . ip + port } /code/` ;
331331 ip . textContent = deviceInfo . ip ;
332+ this . _currentModal . querySelector ( "#builddate" ) . textContent = deviceInfo . build_date ;
333+ this . _currentModal . querySelector ( "#mcuname" ) . textContent = deviceInfo . mcu_name ;
334+ this . _currentModal . querySelector ( "#boardid" ) . textContent = deviceInfo . board_id ;
335+ this . _currentModal . querySelector ( "#uid" ) . textContent = deviceInfo . uid ;
332336 }
333337
334338 async _refreshDevices ( ) {
@@ -378,11 +382,43 @@ class DiscoveryModal extends GenericModal {
378382 }
379383}
380384
385+ class DeviceInfoModal extends GenericModal {
386+ async _getDeviceInfo ( ) {
387+ const deviceInfo = await this . _showBusy ( this . _fileHelper . versionInfo ( ) ) ;
388+ this . _currentModal . querySelector ( "#version" ) . textContent = deviceInfo . version ;
389+ const boardLink = this . _currentModal . querySelector ( "#board" ) ;
390+ boardLink . href = `https://circuitpython.org/board/${ deviceInfo . board_id } /` ;
391+ boardLink . textContent = deviceInfo . board_name ;
392+ this . _currentModal . querySelector ( "#builddate" ) . textContent = deviceInfo . build_date ;
393+ this . _currentModal . querySelector ( "#mcuname" ) . textContent = deviceInfo . mcu_name ;
394+ this . _currentModal . querySelector ( "#boardid" ) . textContent = deviceInfo . board_id ;
395+ this . _currentModal . querySelector ( "#uid" ) . textContent = deviceInfo . uid ;
396+ }
397+
398+ async open ( workflow , documentState ) {
399+ this . _workflow = workflow ;
400+ this . _fileHelper = workflow . fileHelper ;
401+ this . _showBusy = workflow . showBusy . bind ( workflow ) ;
402+ this . _docState = documentState ;
403+
404+ let p = super . open ( ) ;
405+ const okButton = this . _currentModal . querySelector ( "button.ok-button" ) ;
406+ this . _addDialogElement ( 'okButton' , okButton , 'click' , this . _closeModal ) ;
407+
408+ const refreshIcon = this . _currentModal . querySelector ( "i.refresh" ) ;
409+ this . _addDialogElement ( 'refreshIcon' , refreshIcon , 'click' , this . _refreshDevices ) ;
410+
411+ await this . _getDeviceInfo ( ) ;
412+ return p ;
413+ }
414+ }
415+
381416export {
382417 GenericModal ,
383418 MessageModal ,
384419 ButtonValueDialog ,
385420 UnsavedDialog ,
386421 DiscoveryModal ,
387- ProgressDialog
422+ ProgressDialog ,
423+ DeviceInfoModal
388424} ;
0 commit comments