Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix version selector #726

Merged
merged 2 commits into from
May 23, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
ludeeus marked this conversation as resolved.
Show resolved Hide resolved

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

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