diff --git a/src/panels/config/dashboard/ha-config-dashboard.ts b/src/panels/config/dashboard/ha-config-dashboard.ts index 672648cc94..ad05c9d55f 100644 --- a/src/panels/config/dashboard/ha-config-dashboard.ts +++ b/src/panels/config/dashboard/ha-config-dashboard.ts @@ -3,7 +3,14 @@ import "@material/mwc-list/mwc-list-item"; import type { ActionDetail } from "@material/mwc-list"; import "@polymer/app-layout/app-header/app-header"; import "@polymer/app-layout/app-toolbar/app-toolbar"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { + css, + CSSResultGroup, + html, + LitElement, + PropertyValues, + TemplateResult, +} from "lit"; import { customElement, property } from "lit/decorators"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; import "../../../components/ha-card"; @@ -26,6 +33,7 @@ import "./ha-config-navigation"; import "./ha-config-updates"; import { fireEvent } from "../../../common/dom/fire_event"; import { showAlertDialog } from "../../../dialogs/generic/show-dialog-box"; +import { showToast } from "../../../util/toast"; @customElement("ha-config-dashboard") class HaConfigDashboard extends LitElement { @@ -43,6 +51,8 @@ class HaConfigDashboard extends LitElement { @property() public showAdvanced!: boolean; + private _notifyUpdates = false; + protected render(): TemplateResult { return html` @@ -129,6 +139,26 @@ class HaConfigDashboard extends LitElement { `; } + protected override updated(changedProps: PropertyValues): void { + super.updated(changedProps); + + if (!changedProps.has("supervisorUpdates") || !this._notifyUpdates) { + return; + } + this._notifyUpdates = false; + if (this.supervisorUpdates?.length) { + showToast(this, { + message: this.hass.localize( + "ui.panel.config.updates.updates_refreshed" + ), + }); + } else { + showToast(this, { + message: this.hass.localize("ui.panel.config.updates.no_new_updates"), + }); + } + } + private _showQuickBar(): void { showQuickBar(this, { commandMode: true, @@ -140,6 +170,7 @@ class HaConfigDashboard extends LitElement { switch (ev.detail.index) { case 0: if (isComponentLoaded(this.hass, "hassio")) { + this._notifyUpdates = true; await refreshSupervisorAvailableUpdates(this.hass); fireEvent(this, "ha-refresh-supervisor"); return; diff --git a/src/translations/en.json b/src/translations/en.json index 672b952ef8..1e40968ce6 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -1011,6 +1011,8 @@ "description": "You need to run the Home Assistant operating system to be able to check and install updates from the Home Assistant user interface." }, "check_updates": "Check for updates", + "no_new_updates": "No new updates found", + "updates_refreshed": "Updates refreshed", "title": "{count} {count, plural,\n one {update}\n other {updates}\n}", "unable_to_fetch": "Unable to load updates", "version_available": "Version {version_available} is available",