mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Fix helper entity settings (removing) (#16320)
This commit is contained in:
parent
9852186ff7
commit
a5759e36b2
@ -43,7 +43,7 @@ import {
|
|||||||
STREAM_TYPE_HLS,
|
STREAM_TYPE_HLS,
|
||||||
updateCameraPrefs,
|
updateCameraPrefs,
|
||||||
} from "../../../data/camera";
|
} from "../../../data/camera";
|
||||||
import { ConfigEntry, getConfigEntries } from "../../../data/config_entries";
|
import { ConfigEntry } from "../../../data/config_entries";
|
||||||
import {
|
import {
|
||||||
createConfigFlow,
|
createConfigFlow,
|
||||||
handleConfigFlowStep,
|
handleConfigFlowStep,
|
||||||
@ -129,6 +129,8 @@ export class EntityRegistrySettingsEditor extends LitElement {
|
|||||||
|
|
||||||
@property({ type: Boolean }) public disabled = false;
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
|
@property() public helperConfigEntry?: ConfigEntry;
|
||||||
|
|
||||||
@state() private _name!: string;
|
@state() private _name!: string;
|
||||||
|
|
||||||
@state() private _icon!: string;
|
@state() private _icon!: string;
|
||||||
@ -147,8 +149,6 @@ export class EntityRegistrySettingsEditor extends LitElement {
|
|||||||
|
|
||||||
@state() private _device?: DeviceRegistryEntry;
|
@state() private _device?: DeviceRegistryEntry;
|
||||||
|
|
||||||
@state() private _helperConfigEntry?: ConfigEntry;
|
|
||||||
|
|
||||||
@state() private _unit_of_measurement?: string | null;
|
@state() private _unit_of_measurement?: string | null;
|
||||||
|
|
||||||
@state() private _precision?: number | null;
|
@state() private _precision?: number | null;
|
||||||
@ -177,20 +177,6 @@ export class EntityRegistrySettingsEditor extends LitElement {
|
|||||||
|
|
||||||
private _deviceClassOptions?: string[][];
|
private _deviceClassOptions?: string[][];
|
||||||
|
|
||||||
protected firstUpdated(changedProps: PropertyValues): void {
|
|
||||||
super.firstUpdated(changedProps);
|
|
||||||
if (this.entry.config_entry_id) {
|
|
||||||
getConfigEntries(this.hass, {
|
|
||||||
type: ["helper"],
|
|
||||||
domain: this.entry.platform,
|
|
||||||
}).then((entries) => {
|
|
||||||
this._helperConfigEntry = entries.find(
|
|
||||||
(ent) => ent.entry_id === this.entry.config_entry_id
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected willUpdate(changedProperties: PropertyValues) {
|
protected willUpdate(changedProperties: PropertyValues) {
|
||||||
super.willUpdate(changedProperties);
|
super.willUpdate(changedProperties);
|
||||||
if (!changedProperties.has("entry")) {
|
if (!changedProperties.has("entry")) {
|
||||||
@ -686,7 +672,7 @@ export class EntityRegistrySettingsEditor extends LitElement {
|
|||||||
</ha-settings-row>
|
</ha-settings-row>
|
||||||
`
|
`
|
||||||
: ""}
|
: ""}
|
||||||
${this._helperConfigEntry && this._helperConfigEntry.supports_options
|
${this.helperConfigEntry && this.helperConfigEntry.supports_options
|
||||||
? html`
|
? html`
|
||||||
<ha-list-item
|
<ha-list-item
|
||||||
class="menu-item"
|
class="menu-item"
|
||||||
@ -701,7 +687,7 @@ export class EntityRegistrySettingsEditor extends LitElement {
|
|||||||
"integration",
|
"integration",
|
||||||
domainToName(
|
domainToName(
|
||||||
this.hass.localize,
|
this.hass.localize,
|
||||||
this._helperConfigEntry.domain
|
this.helperConfigEntry.domain
|
||||||
)
|
)
|
||||||
)}</span
|
)}</span
|
||||||
>
|
>
|
||||||
@ -711,7 +697,7 @@ export class EntityRegistrySettingsEditor extends LitElement {
|
|||||||
"integration",
|
"integration",
|
||||||
domainToName(
|
domainToName(
|
||||||
this.hass.localize,
|
this.hass.localize,
|
||||||
this._helperConfigEntry.domain
|
this.helperConfigEntry.domain
|
||||||
)
|
)
|
||||||
)}</span
|
)}</span
|
||||||
>
|
>
|
||||||
@ -1124,7 +1110,7 @@ export class EntityRegistrySettingsEditor extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async _showOptionsFlow() {
|
private async _showOptionsFlow() {
|
||||||
showOptionsFlowDialog(this, this._helperConfigEntry!, null);
|
showOptionsFlowDialog(this, this.helperConfigEntry!, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _switchAsDomainsSorted = memoizeOne(
|
private _switchAsDomainsSorted = memoizeOne(
|
||||||
|
@ -2,11 +2,15 @@ import "@material/mwc-button/mwc-button";
|
|||||||
import "@material/mwc-formfield/mwc-formfield";
|
import "@material/mwc-formfield/mwc-formfield";
|
||||||
import "@material/mwc-list/mwc-list-item";
|
import "@material/mwc-list/mwc-list-item";
|
||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
import { css, CSSResultGroup, html, LitElement } from "lit";
|
import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit";
|
||||||
import { customElement, property, query, state } from "lit/decorators";
|
import { customElement, property, query, state } from "lit/decorators";
|
||||||
import { fireEvent } from "../../../common/dom/fire_event";
|
import { fireEvent } from "../../../common/dom/fire_event";
|
||||||
import "../../../components/ha-alert";
|
import "../../../components/ha-alert";
|
||||||
import { ConfigEntry, deleteConfigEntry } from "../../../data/config_entries";
|
import {
|
||||||
|
ConfigEntry,
|
||||||
|
deleteConfigEntry,
|
||||||
|
getConfigEntries,
|
||||||
|
} from "../../../data/config_entries";
|
||||||
import { updateDeviceRegistryEntry } from "../../../data/device_registry";
|
import { updateDeviceRegistryEntry } from "../../../data/device_registry";
|
||||||
import {
|
import {
|
||||||
ExtEntityRegistryEntry,
|
ExtEntityRegistryEntry,
|
||||||
@ -41,6 +45,20 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) {
|
|||||||
@query("entity-registry-settings-editor")
|
@query("entity-registry-settings-editor")
|
||||||
private _registryEditor?: EntityRegistrySettingsEditor;
|
private _registryEditor?: EntityRegistrySettingsEditor;
|
||||||
|
|
||||||
|
protected firstUpdated(changedProps: PropertyValues): void {
|
||||||
|
super.firstUpdated(changedProps);
|
||||||
|
if (this.entry.config_entry_id) {
|
||||||
|
getConfigEntries(this.hass, {
|
||||||
|
type: ["helper"],
|
||||||
|
domain: this.entry.platform,
|
||||||
|
}).then((entries) => {
|
||||||
|
this._helperConfigEntry = entries.find(
|
||||||
|
(ent) => ent.entry_id === this.entry.config_entry_id
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
const stateObj: HassEntity | undefined =
|
const stateObj: HassEntity | undefined =
|
||||||
this.hass.states[this.entry.entity_id];
|
this.hass.states[this.entry.entity_id];
|
||||||
@ -90,6 +108,7 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) {
|
|||||||
<entity-registry-settings-editor
|
<entity-registry-settings-editor
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.entry=${this.entry}
|
.entry=${this.entry}
|
||||||
|
.helperConfigEntry=${this._helperConfigEntry}
|
||||||
.disabled=${this._submitting}
|
.disabled=${this._submitting}
|
||||||
@change=${this._entityRegistryChanged}
|
@change=${this._entityRegistryChanged}
|
||||||
></entity-registry-settings-editor>
|
></entity-registry-settings-editor>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user