mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-01 05:27:46 +00:00
Fix startup notifications
This commit is contained in:
parent
2518b1a79d
commit
24f9944319
@ -8,6 +8,8 @@ import type { HaToast } from "../components/ha-toast";
|
|||||||
import type { HomeAssistant } from "../types";
|
import type { HomeAssistant } from "../types";
|
||||||
|
|
||||||
export interface ShowToastParams {
|
export interface ShowToastParams {
|
||||||
|
// Unique ID for the toast. If a new toast is shown with the same ID as the previous toast, it will be replaced to avoid flickering.
|
||||||
|
id?: string;
|
||||||
message: string;
|
message: string;
|
||||||
action?: ToastActionParams;
|
action?: ToastActionParams;
|
||||||
duration?: number;
|
duration?: number;
|
||||||
@ -27,7 +29,9 @@ class NotificationManager extends LitElement {
|
|||||||
@query("ha-toast") private _toast!: HaToast | undefined;
|
@query("ha-toast") private _toast!: HaToast | undefined;
|
||||||
|
|
||||||
public async showDialog(parameters: ShowToastParams) {
|
public async showDialog(parameters: ShowToastParams) {
|
||||||
this._toast?.close();
|
if (!parameters.id || this._parameters?.id !== parameters.id) {
|
||||||
|
this._toast?.close();
|
||||||
|
}
|
||||||
|
|
||||||
if (!parameters || parameters.duration === 0) {
|
if (!parameters || parameters.duration === 0) {
|
||||||
this._parameters = undefined;
|
this._parameters = undefined;
|
||||||
|
@ -143,6 +143,7 @@ export default <T extends Constructor<HassBaseEl>>(superClass: T) =>
|
|||||||
)[0][0];
|
)[0][0];
|
||||||
|
|
||||||
showToast(this, {
|
showToast(this, {
|
||||||
|
id: "integration_starting",
|
||||||
message:
|
message:
|
||||||
this.hass!.localize("ui.notification_toast.integration_starting", {
|
this.hass!.localize("ui.notification_toast.integration_starting", {
|
||||||
integration: domainToName(this.hass!.localize, integration),
|
integration: domainToName(this.hass!.localize, integration),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user