From 984bd39719a99f0467bbd50c041bc37e55cca5a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Thu, 4 Jul 2024 17:38:35 +0200 Subject: [PATCH] Remove version selector (#749) --- .../dialogs/hacs-download-dialog.ts | 93 +------------------ src/data/repository.ts | 12 --- src/data/websocket.ts | 7 -- src/localize/languages/en.json | 4 +- 4 files changed, 5 insertions(+), 111 deletions(-) diff --git a/src/components/dialogs/hacs-download-dialog.ts b/src/components/dialogs/hacs-download-dialog.ts index b0d038a9..d82fbb56 100644 --- a/src/components/dialogs/hacs-download-dialog.ts +++ b/src/components/dialogs/hacs-download-dialog.ts @@ -10,7 +10,6 @@ import "../../../homeassistant-frontend/src/components/ha-alert"; import "../../../homeassistant-frontend/src/components/ha-button"; 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"; @@ -19,13 +18,11 @@ 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 } from "../../tools/frontend-resource"; import type { HacsDownloadDialogParams } from "./show-hacs-dialog"; -import { documentationUrl } from "../../tools/documentation"; @customElement("hacs-download-dialog") export class HacsDonwloadDialog extends LitElement { @@ -95,28 +92,7 @@ export class HacsDonwloadDialog extends LitElement { if (!this._dialogParams || !this._repository) { return nothing; } - 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`
- ${this._repository.version_or_commit === "version" && this._repository.installed - ? html` - - schema.name === "beta" - ? this._dialogParams!.hacs.localize("dialog_download.show_beta") - : this._dialogParams!.hacs.localize("dialog_download.select_version")} - @value-changed=${this._valueChanged} - > - - - ${this._dialogParams!.hacs.localize("dialog_download.selector_note")} - - ${this._dialogParams!.hacs.localize("common.learn_more")} - - ` - : nothing} ${!this._repository.can_download ? html` ${this._dialogParams.hacs.localize("confirm.home_assistant_version_not_correct", { @@ -210,30 +152,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, - ); - this._selectedVersion = ev.detail.value.version; - } - if (updateNeeded) { - await this._fetchRepository(); - this._waiting = false; - } - } - private async _installRepository(): Promise { if (!this._repository) { return; @@ -257,16 +175,13 @@ export class HacsDonwloadDialog extends LitElement { this._installing = true; this._error = undefined; - const selectedVersion = - this._repository.selected_tag || - this._repository.available_version || - this._repository.default_branch; - try { await repositoryDownloadVersion( this.hass, String(this._repository.id), - this._repository?.version_or_commit !== "commit" ? this._selectedVersion : undefined, + this._repository?.version_or_commit !== "commit" + ? this._repository.available_version + : undefined, ); } catch (err: any) { this._error = err || { diff --git a/src/data/repository.ts b/src/data/repository.ts index 030f55bc..a7008dc0 100644 --- a/src/data/repository.ts +++ b/src/data/repository.ts @@ -40,7 +40,6 @@ export interface RepositoryBase { export interface RepositoryInfo extends RepositoryBase { additional_info: string; - beta: boolean; default_branch: string; hide_default_branch: boolean; issues: number; @@ -69,14 +68,3 @@ export const repositoryDownloadVersion = async ( repository: repository, version, }); - -export const repositorySetVersion = async ( - hass: HomeAssistant, - repository: string, - version: string, -) => - hass.connection.sendMessagePromise({ - type: "hacs/repository/version", - repository: repository, - version, - }); diff --git a/src/data/websocket.ts b/src/data/websocket.ts index da292a04..3757c19d 100644 --- a/src/data/websocket.ts +++ b/src/data/websocket.ts @@ -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({ - type: "hacs/repository/beta", - repository, - show_beta: beta, - }); - export const repositoryUpdate = async (hass: HomeAssistant, repository: string) => hass.connection.sendMessagePromise({ type: "hacs/repository/refresh", diff --git a/src/localize/languages/en.json b/src/localize/languages/en.json index 7a00363f..6bd98090 100644 --- a/src/localize/languages/en.json +++ b/src/localize/languages/en.json @@ -73,8 +73,6 @@ "dialog_download": { "type": "Type", "url": "URL", - "select_version": "Select version", - "show_beta": "Show beta versions", "restart": "Remember that you need to restart Home Assistant before changes to integrations (custom_components) are applied.", "selector_note": "The version selector will be removed in a future release. If you need to install a specific version, you can do so by using the service call for update entities.", "note_downloaded": "When downloaded, this will be located in {location}", @@ -133,4 +131,4 @@ "confirm": "Go to integrations" } } -} +} \ No newline at end of file