Skip to content

Commit be59de5

Browse files
makermelissagithub-actions[bot]
authored andcommitted
Github Action: Updated dist files
1 parent 8985632 commit be59de5

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

dist/cpinstaller.js

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)