@@ -110,8 +110,16 @@ export class CPInstallButton extends InstallButton {
110110 }
111111
112112 async connectedCallback ( ) {
113- // Required
114- this . boardIds = this . getAttribute ( "boardid" ) . split ( "," ) ;
113+ // Load the Board Definitions before the button is ever clicked
114+ const response = await fetch ( BOARD_DEFS ) ;
115+ this . boardDefs = await response . json ( ) ;
116+
117+ let boardIds = this . getAttribute ( "boardid" )
118+ if ( ! boardIds || boardIds . trim ( ) . length === 0 ) {
119+ this . boardIds = Object . keys ( this . boardDefs ) ;
120+ } else {
121+ this . boardIds = boardIds . split ( "," ) ;
122+ }
115123
116124 // If there is only one board id, then select it by default
117125 if ( this . boardIds . length === 1 ) {
@@ -123,10 +131,6 @@ export class CPInstallButton extends InstallButton {
123131 this . releaseVersion = this . getAttribute ( "version" ) ;
124132 }
125133
126- // Load the Board Definitions before the button is ever clicked
127- const response = await fetch ( BOARD_DEFS ) ;
128- this . boardDefs = await response . json ( ) ;
129-
130134 super . connectedCallback ( ) ;
131135 }
132136
@@ -439,6 +443,18 @@ export class CPInstallButton extends InstallButton {
439443 for ( let boardId of this . boardIds ) {
440444 options . push ( { id : boardId , name : this . getBoardName ( boardId ) } ) ;
441445 }
446+
447+ options . sort ( ( a , b ) => {
448+ let boardA = a . name . trim ( ) . toLowerCase ( ) ;
449+ let boardB = b . name . trim ( ) . toLowerCase ( ) ;
450+ if ( boardA < boardB ) {
451+ return - 1 ;
452+ }
453+ if ( boardA > boardB ) {
454+ return 1 ;
455+ }
456+ return 0 ;
457+ } ) ;
442458 return options ;
443459 }
444460
0 commit comments