diff --git a/src/components/dialogs/hacs-removed-dialog.ts b/src/components/dialogs/hacs-removed-dialog.ts index 70b5350d..52c906af 100644 --- a/src/components/dialogs/hacs-removed-dialog.ts +++ b/src/components/dialogs/hacs-removed-dialog.ts @@ -1,7 +1,13 @@ import { css, html, TemplateResult } from "lit"; import { customElement, property } from "lit/decorators"; import { Repository } from "../../data/common"; -import { deleteResource, fetchResources, repositoryUninstall } from "../../data/websocket"; +import { + deleteResource, + fetchResources, + getRemovedRepositories, + repositoryIgnore, + repositoryUninstall, +} from "../../data/websocket"; import { HacsStyles } from "../../styles/hacs-common-style"; import "./hacs-dialog"; import { HacsDialogBase } from "./hacs-dialog-base"; @@ -43,6 +49,9 @@ export class HacsRemovedDialog extends HacsDialogBase { ` : ""} + + ${this.hacs.localize("common.ignore")} + ${this._updating ? html`` @@ -67,6 +76,26 @@ export class HacsRemovedDialog extends HacsDialogBase { return `/hacsfiles/${this.repository?.full_name.split("/")[1]}/${this.repository?.file_name}`; } + private async _ignoreRepository(): Promise { + await repositoryIgnore(this.hass, this.repository.full_name); + + const removed = await getRemovedRepositories(this.hass); + this.dispatchEvent( + new CustomEvent("update-hacs", { + detail: { removed }, + bubbles: true, + composed: true, + }) + ); + + this.dispatchEvent( + new Event("hacs-dialog-closed", { + bubbles: true, + composed: true, + }) + ); + } + private async _uninstallRepository(): Promise { this._updating = true; if ( diff --git a/src/data/websocket.ts b/src/data/websocket.ts index d521a226..cbc25a09 100644 --- a/src/data/websocket.ts +++ b/src/data/websocket.ts @@ -60,6 +60,13 @@ export const repositoryUninstall = async (hass: HomeAssistant, repository: strin }); }; +export const repositoryIgnore = async (hass: HomeAssistant, repository: string) => { + await hass.connection.sendMessagePromise({ + type: "hacs/repository/ignore", + repository: repository, + }); +}; + export const repositoryReleasenotes = async (hass: HomeAssistant, repository: string) => { const response = await hass.connection.sendMessagePromise< { name: string; body: string; tag: string }[] diff --git a/src/localize/languages/en.json b/src/localize/languages/en.json index 695876ee..413524a6 100644 --- a/src/localize/languages/en.json +++ b/src/localize/languages/en.json @@ -17,6 +17,7 @@ "remove": "Remove", "repositories": "Repositories", "repository": "Repository", + "show": "Show", "theme": "Theme", "update": "Update", "updates": "Updates", diff --git a/src/panels/hacs-entry-panel.ts b/src/panels/hacs-entry-panel.ts index 1d97f5df..95f2a78a 100644 --- a/src/panels/hacs-entry-panel.ts +++ b/src/panels/hacs-entry-panel.ts @@ -96,7 +96,7 @@ export class HacsEntryPanel extends LitElement { .label=${message.path ? this.hacs.localize("common.navigate") : message.dialog - ? this.hacs.localize(`common.${message.dialog}`) + ? this.hacs.localize("common.show") : ""} @click=${() => message.path ? navigate(message.path) : this._openDialog(message)} diff --git a/src/tools/get-messages.ts b/src/tools/get-messages.ts index 7874b42b..4b9664a4 100644 --- a/src/tools/get-messages.ts +++ b/src/tools/get-messages.ts @@ -21,7 +21,7 @@ export const getMessages = memoizeOne((hacs: Hacs): Message[] => { repository: removedrepo.repository, }), info: removedrepo.reason, - severity: "error", + severity: "warning", dialog: "remove", repository: repo, });