mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 11:46:42 +00:00
Show picture-elements error messages for elements (#26196)
This commit is contained in:
parent
adea2efb01
commit
0d6db8b834
@ -23,6 +23,8 @@ class HuiPictureElementsCard extends LitElement implements LovelaceCard {
|
|||||||
|
|
||||||
@property({ attribute: false }) public hass?: HomeAssistant;
|
@property({ attribute: false }) public hass?: HomeAssistant;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public preview = false;
|
||||||
|
|
||||||
@state() private _elements?: LovelaceElement[];
|
@state() private _elements?: LovelaceElement[];
|
||||||
|
|
||||||
public static getStubConfig(
|
public static getStubConfig(
|
||||||
@ -98,6 +100,12 @@ class HuiPictureElementsCard extends LitElement implements LovelaceCard {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this._elements && changedProps.has("preview")) {
|
||||||
|
for (const element of this._elements) {
|
||||||
|
element.preview = this.preview;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const oldHass = changedProps.get("hass") as HomeAssistant | undefined;
|
const oldHass = changedProps.get("hass") as HomeAssistant | undefined;
|
||||||
const oldConfig = changedProps.get("_config") as
|
const oldConfig = changedProps.get("_config") as
|
||||||
| PictureElementsCardConfig
|
| PictureElementsCardConfig
|
||||||
@ -180,6 +188,7 @@ class HuiPictureElementsCard extends LitElement implements LovelaceCard {
|
|||||||
if (this.hass) {
|
if (this.hass) {
|
||||||
element.hass = this.hass;
|
element.hass = this.hass;
|
||||||
}
|
}
|
||||||
|
element.preview = this.preview;
|
||||||
element.addEventListener(
|
element.addEventListener(
|
||||||
"ll-rebuild",
|
"ll-rebuild",
|
||||||
(ev) => {
|
(ev) => {
|
||||||
|
@ -228,6 +228,7 @@ export interface EntityFilterCardConfig extends LovelaceCardConfig {
|
|||||||
|
|
||||||
export interface ErrorCardConfig extends LovelaceCardConfig {
|
export interface ErrorCardConfig extends LovelaceCardConfig {
|
||||||
error?: string;
|
error?: string;
|
||||||
|
message?: string;
|
||||||
origConfig?: LovelaceCardConfig;
|
origConfig?: LovelaceCardConfig;
|
||||||
severity?: "warning" | "error";
|
severity?: "warning" | "error";
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ export type LovelaceElementConfig =
|
|||||||
|
|
||||||
export interface LovelaceElement extends HTMLElement {
|
export interface LovelaceElement extends HTMLElement {
|
||||||
hass?: HomeAssistant;
|
hass?: HomeAssistant;
|
||||||
|
preview?: boolean;
|
||||||
setConfig(config: LovelaceElementConfig): void;
|
setConfig(config: LovelaceElementConfig): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user