Skip to content

Commit

Permalink
Fix version selector
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus committed May 23, 2024
1 parent 06bf2ed commit 97200c6
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions src/components/dialogs/hacs-download-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ export class HacsDonwloadDialog extends LitElement {
}

const installPath = this._getInstallPath(this._repository);
const selectedVersion =
this._repository.selected_tag ||
this._repository.available_version ||
this._repository.default_branch;
const donwloadRepositorySchema: HaFormSchema[] = [
{
name: "beta",
Expand Down Expand Up @@ -127,7 +131,7 @@ export class HacsDonwloadDialog extends LitElement {
.data=${this._repository.version_or_commit === "version"
? {
beta: this._repository.beta,
version: this._repository.releases[0],
version: selectedVersion,
}
: {}}
.schema=${donwloadRepositorySchema}
Expand Down Expand Up @@ -229,12 +233,28 @@ export class HacsDonwloadDialog extends LitElement {
}

private async _installRepository(): Promise<void> {
this._installing = true;
this._error = undefined;
if (!this._repository) {
return;
}

if (this._waiting) {
this._error = "Waiting to update repository information, try later.";
return;
}

if (this._installing) {
this._error = "Already installing, please wait.";
return;
}

if (!this._repository.can_download) {
this._error = "Can not download this repository.";
return;
}

this._installing = true;
this._error = undefined;

const selectedVersion =
this._repository.selected_tag ||
this._repository.available_version ||
Expand Down

0 comments on commit 97200c6

Please sign in to comment.