mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-29 20:26:39 +00:00
Prevent old more info control to be created (#7324)
This commit is contained in:
parent
288bf6805a
commit
5740b018a7
@ -10,10 +10,7 @@ export const dynamicElement = directive(
|
|||||||
|
|
||||||
let element = part.value as HTMLElement | undefined;
|
let element = part.value as HTMLElement | undefined;
|
||||||
|
|
||||||
if (
|
if (tag === element?.localName) {
|
||||||
element !== undefined &&
|
|
||||||
tag.toUpperCase() === (element as HTMLElement).tagName
|
|
||||||
) {
|
|
||||||
if (properties) {
|
if (properties) {
|
||||||
Object.entries(properties).forEach(([key, value]) => {
|
Object.entries(properties).forEach(([key, value]) => {
|
||||||
element![key] = value;
|
element![key] = value;
|
||||||
|
@ -70,8 +70,21 @@ export class MoreInfoDialog extends LitElement {
|
|||||||
this._entityId = params.entityId;
|
this._entityId = params.entityId;
|
||||||
if (!this._entityId) {
|
if (!this._entityId) {
|
||||||
this.closeDialog();
|
this.closeDialog();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
this.large = false;
|
this.large = false;
|
||||||
|
|
||||||
|
const stateObj = this.hass.states[this._entityId];
|
||||||
|
if (!stateObj) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (stateObj.attributes && "custom_ui_more_info" in stateObj.attributes) {
|
||||||
|
this._moreInfoType = stateObj.attributes.custom_ui_more_info;
|
||||||
|
} else {
|
||||||
|
const type = stateMoreInfoType(stateObj);
|
||||||
|
importMoreInfoControl(type);
|
||||||
|
this._moreInfoType = type === "hidden" ? undefined : `more-info-${type}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog() {
|
public closeDialog() {
|
||||||
@ -94,23 +107,6 @@ export class MoreInfoDialog extends LitElement {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected updated(changedProperties) {
|
|
||||||
if (!this.hass || !this._entityId || !changedProperties.has("_entityId")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const stateObj = this.hass.states[this._entityId];
|
|
||||||
if (!stateObj) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (stateObj.attributes && "custom_ui_more_info" in stateObj.attributes) {
|
|
||||||
this._moreInfoType = stateObj.attributes.custom_ui_more_info;
|
|
||||||
} else {
|
|
||||||
const type = stateMoreInfoType(stateObj);
|
|
||||||
importMoreInfoControl(type);
|
|
||||||
this._moreInfoType = type === "hidden" ? undefined : `more-info-${type}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
if (!this._entityId) {
|
if (!this._entityId) {
|
||||||
return html``;
|
return html``;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user