Github Action: Updated dist files

This commit is contained in:
makermelissa 2023-03-15 23:53:26 +00:00 committed by github-actions[bot]
parent 8985632779
commit be59de5d4a
2 changed files with 24 additions and 8 deletions

28
dist/cpinstaller.js vendored
View file

@ -110,8 +110,16 @@ export class CPInstallButton extends InstallButton {
} }
async connectedCallback() { async connectedCallback() {
// Required // Load the Board Definitions before the button is ever clicked
this.boardIds = this.getAttribute("boardid").split(","); const response = await fetch(BOARD_DEFS);
this.boardDefs = await response.json();
let boardIds = this.getAttribute("boardid")
if (!boardIds || boardIds.trim().length === 0) {
this.boardIds = Object.keys(this.boardDefs);
} else {
this.boardIds = boardIds.split(",");
}
// If there is only one board id, then select it by default // If there is only one board id, then select it by default
if (this.boardIds.length === 1) { if (this.boardIds.length === 1) {
@ -123,10 +131,6 @@ export class CPInstallButton extends InstallButton {
this.releaseVersion = this.getAttribute("version"); this.releaseVersion = this.getAttribute("version");
} }
// Load the Board Definitions before the button is ever clicked
const response = await fetch(BOARD_DEFS);
this.boardDefs = await response.json();
super.connectedCallback(); super.connectedCallback();
} }
@ -439,6 +443,18 @@ export class CPInstallButton extends InstallButton {
for (let boardId of this.boardIds) { for (let boardId of this.boardIds) {
options.push({id: boardId, name: this.getBoardName(boardId)}); options.push({id: boardId, name: this.getBoardName(boardId)});
} }
options.sort((a, b) => {
let boardA = a.name.trim().toLowerCase();
let boardB = b.name.trim().toLowerCase();
if (boardA < boardB) {
return -1;
}
if (boardA > boardB) {
return 1;
}
return 0;
});
return options; return options;
} }

File diff suppressed because one or more lines are too long