Skip to content

Commit

Permalink
Remove version selector (#684)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus authored Oct 29, 2023
1 parent e94f2a0 commit 03507be
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 85 deletions.
68 changes: 1 addition & 67 deletions src/components/dialogs/hacs-download-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import { mainWindow } from "../../../homeassistant-frontend/src/common/dom/get_m
import { computeRTL } from "../../../homeassistant-frontend/src/common/util/compute_rtl";
import "../../../homeassistant-frontend/src/components/ha-alert";
import "../../../homeassistant-frontend/src/components/ha-dialog";
import "../../../homeassistant-frontend/src/components/ha-form/ha-form";
import { HaFormSchema } from "../../../homeassistant-frontend/src/components/ha-form/types";
import { showConfirmationDialog } from "../../../homeassistant-frontend/src/dialogs/generic/show-dialog-box";
import type { HomeAssistant } from "../../../homeassistant-frontend/src/types";
import { HacsDispatchEvent } from "../../data/common";
Expand All @@ -18,9 +16,8 @@ import {
RepositoryBase,
repositoryDownloadVersion,
RepositoryInfo,
repositorySetVersion,
} from "../../data/repository";
import { repositoryBeta, websocketSubscription } from "../../data/websocket";
import { websocketSubscription } from "../../data/websocket";
import { HacsStyles } from "../../styles/hacs-common-style";
import { generateFrontendResourceURL, updateFrontendResource } from "../../tools/frontend-resource";
import type { HacsDownloadDialogParams } from "./show-hacs-dialog";
Expand Down Expand Up @@ -82,26 +79,6 @@ export class HacsDonwloadDialog extends LitElement {
}

const installPath = this._getInstallPath(this._repository);
const donwloadRepositorySchema: HaFormSchema[] = [
{
name: "beta",
selector: { boolean: {} },
},
{
name: "version",
selector: {
select: {
options: this._repository.releases.concat(
this._repository.full_name === "hacs/integration" ||
this._repository.hide_default_branch
? []
: [this._repository.default_branch]
),
mode: "dropdown",
},
},
},
];
return html`
<ha-dialog
open
Expand All @@ -111,26 +88,6 @@ export class HacsDonwloadDialog extends LitElement {
@closed=${this.closeDialog}
>
<div class="content">
${this._repository.version_or_commit === "version"
? html`
<ha-form
.disabled=${this._waiting}
.data=${this._repository.version_or_commit === "version"
? {
beta: this._repository.beta,
version: this._repository.releases[0],
}
: {}}
.schema=${donwloadRepositorySchema}
.computeLabel=${(schema: HaFormSchema) =>
schema.name === "beta"
? this._dialogParams!.hacs.localize("dialog_download.show_beta")
: this._dialogParams!.hacs.localize("dialog_download.select_version")}
@value-changed=${this._valueChanged}
>
</ha-form>
`
: nothing}
${!this._repository.can_download
? html`<ha-alert alert-type="error" .rtl=${computeRTL(this.hass)}>
${this._dialogParams.hacs.localize("confirm.home_assistant_version_not_correct", {
Expand Down Expand Up @@ -181,29 +138,6 @@ export class HacsDonwloadDialog extends LitElement {
`;
}

private async _valueChanged(ev) {
let updateNeeded = false;
if (this._repository!.beta !== ev.detail.value.beta) {
updateNeeded = true;
this._waiting = true;
await repositoryBeta(this.hass, this._dialogParams!.repositoryId, ev.detail.value.beta);
}
if (ev.detail.value.version) {
updateNeeded = true;
this._waiting = true;

await repositorySetVersion(
this.hass,
this._dialogParams!.repositoryId,
ev.detail.value.version
);
}
if (updateNeeded) {
await this._fetchRepository();
this._waiting = false;
}
}

private async _installRepository(): Promise<void> {
this._installing = true;
if (!this._repository) {
Expand Down
11 changes: 0 additions & 11 deletions src/data/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,3 @@ export const repositoryDownloadVersion = async (
repository: repository,
version,
});

export const repositorySetVersion = async (
hass: HomeAssistant,
repository: string,
version: string
) =>
hass.connection.sendMessagePromise<void>({
type: "hacs/repository/version",
repository: repository,
version,
});
7 changes: 0 additions & 7 deletions src/data/websocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@ export const repositoryAdd = async (hass: HomeAssistant, repository: string, cat
category,
});

export const repositoryBeta = async (hass: HomeAssistant, repository: string, beta: boolean) =>
hass.connection.sendMessagePromise<void>({
type: "hacs/repository/beta",
repository,
show_beta: beta,
});

export const repositoryUpdate = async (hass: HomeAssistant, repository: string) =>
hass.connection.sendMessagePromise<void>({
type: "hacs/repository/refresh",
Expand Down

0 comments on commit 03507be

Please sign in to comment.