mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 11:46:42 +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;
|
||||
|
||||
if (
|
||||
element !== undefined &&
|
||||
tag.toUpperCase() === (element as HTMLElement).tagName
|
||||
) {
|
||||
if (tag === element?.localName) {
|
||||
if (properties) {
|
||||
Object.entries(properties).forEach(([key, value]) => {
|
||||
element![key] = value;
|
||||
|
@ -70,8 +70,21 @@ export class MoreInfoDialog extends LitElement {
|
||||
this._entityId = params.entityId;
|
||||
if (!this._entityId) {
|
||||
this.closeDialog();
|
||||
return;
|
||||
}
|
||||
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() {
|
||||
@ -94,23 +107,6 @@ export class MoreInfoDialog extends LitElement {
|
||||
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() {
|
||||
if (!this._entityId) {
|
||||
return html``;
|
||||
|
Loading…
x
Reference in New Issue
Block a user