mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
20230906.1 (#17838)
This commit is contained in:
commit
35496ead23
@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "home-assistant-frontend"
|
name = "home-assistant-frontend"
|
||||||
version = "20230906.0"
|
version = "20230906.1"
|
||||||
license = {text = "Apache-2.0"}
|
license = {text = "Apache-2.0"}
|
||||||
description = "The Home Assistant frontend"
|
description = "The Home Assistant frontend"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
@ -155,11 +155,12 @@ export class HaConversationAgentPicker extends LitElement {
|
|||||||
if (!this._configEntry) {
|
if (!this._configEntry) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
showOptionsFlowDialog(
|
showOptionsFlowDialog(this, this._configEntry, {
|
||||||
this,
|
manifest: await fetchIntegrationManifest(
|
||||||
this._configEntry,
|
this.hass,
|
||||||
await fetchIntegrationManifest(this.hass, this._configEntry.domain)
|
this._configEntry.domain
|
||||||
);
|
),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static get styles(): CSSResultGroup {
|
static get styles(): CSSResultGroup {
|
||||||
|
@ -49,7 +49,7 @@ class FlowPreviewGroup extends LitElement {
|
|||||||
private _setPreview = (preview: GroupPreview) => {
|
private _setPreview = (preview: GroupPreview) => {
|
||||||
const now = new Date().toISOString();
|
const now = new Date().toISOString();
|
||||||
this._preview = {
|
this._preview = {
|
||||||
entity_id: `${this.stepId}.flow_preview`,
|
entity_id: `${this.stepId}.___flow_preview___`,
|
||||||
last_changed: now,
|
last_changed: now,
|
||||||
last_updated: now,
|
last_updated: now,
|
||||||
context: { id: "", parent_id: null, user_id: null },
|
context: { id: "", parent_id: null, user_id: null },
|
||||||
|
@ -110,11 +110,11 @@ class FlowPreviewTemplate extends LitElement {
|
|||||||
</ul>
|
</ul>
|
||||||
`
|
`
|
||||||
: !this._listeners.time
|
: !this._listeners.time
|
||||||
? html`<span class="all_listeners">
|
? html`<p class="all_listeners">
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
"ui.dialogs.helper_settings.template.no_listeners"
|
"ui.dialogs.helper_settings.template.no_listeners"
|
||||||
)}
|
)}
|
||||||
</span>`
|
</p>`
|
||||||
: nothing} `;
|
: nothing} `;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ class FlowPreviewTemplate extends LitElement {
|
|||||||
this._listeners = preview.listeners;
|
this._listeners = preview.listeners;
|
||||||
const now = new Date().toISOString();
|
const now = new Date().toISOString();
|
||||||
this._preview = {
|
this._preview = {
|
||||||
entity_id: `${this.stepId}.flow_preview`,
|
entity_id: `${this.stepId}.___flow_preview___`,
|
||||||
last_changed: now,
|
last_changed: now,
|
||||||
last_updated: now,
|
last_updated: now,
|
||||||
context: { id: "", parent_id: null, user_id: null },
|
context: { id: "", parent_id: null, user_id: null },
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { html } from "lit";
|
import { html } from "lit";
|
||||||
import { ConfigEntry } from "../../data/config_entries";
|
import { ConfigEntry } from "../../data/config_entries";
|
||||||
import { domainToName, IntegrationManifest } from "../../data/integration";
|
import { domainToName } from "../../data/integration";
|
||||||
import {
|
import {
|
||||||
createOptionsFlow,
|
createOptionsFlow,
|
||||||
deleteOptionsFlow,
|
deleteOptionsFlow,
|
||||||
@ -8,6 +8,7 @@ import {
|
|||||||
handleOptionsFlowStep,
|
handleOptionsFlowStep,
|
||||||
} from "../../data/options_flow";
|
} from "../../data/options_flow";
|
||||||
import {
|
import {
|
||||||
|
DataEntryFlowDialogParams,
|
||||||
loadDataEntryFlowDialog,
|
loadDataEntryFlowDialog,
|
||||||
showFlowDialog,
|
showFlowDialog,
|
||||||
} from "./show-dialog-data-entry-flow";
|
} from "./show-dialog-data-entry-flow";
|
||||||
@ -17,14 +18,14 @@ export const loadOptionsFlowDialog = loadDataEntryFlowDialog;
|
|||||||
export const showOptionsFlowDialog = (
|
export const showOptionsFlowDialog = (
|
||||||
element: HTMLElement,
|
element: HTMLElement,
|
||||||
configEntry: ConfigEntry,
|
configEntry: ConfigEntry,
|
||||||
manifest?: IntegrationManifest | null
|
dialogParams?: Omit<DataEntryFlowDialogParams, "flowConfig">
|
||||||
): void =>
|
): void =>
|
||||||
showFlowDialog(
|
showFlowDialog(
|
||||||
element,
|
element,
|
||||||
{
|
{
|
||||||
startFlowHandler: configEntry.entry_id,
|
startFlowHandler: configEntry.entry_id,
|
||||||
domain: configEntry.domain,
|
domain: configEntry.domain,
|
||||||
manifest,
|
...dialogParams,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
flowType: "options_flow",
|
flowType: "options_flow",
|
||||||
|
@ -1336,7 +1336,7 @@ export class EntityRegistrySettingsEditor extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async _showOptionsFlow() {
|
private async _showOptionsFlow() {
|
||||||
showOptionsFlowDialog(this, this.helperConfigEntry!, null);
|
showOptionsFlowDialog(this, this.helperConfigEntry!);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _switchAsDomainsSorted = memoizeOne(
|
private _switchAsDomainsSorted = memoizeOne(
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import "@lrnwebcomponents/simple-tooltip/simple-tooltip";
|
import "@lrnwebcomponents/simple-tooltip/simple-tooltip";
|
||||||
import { mdiAlertCircle, mdiPencilOff, mdiPlus } from "@mdi/js";
|
import { mdiAlertCircle, mdiPencilOff, mdiPlus } from "@mdi/js";
|
||||||
import { HassEntity, UnsubscribeFunc } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
import { LitElement, PropertyValues, TemplateResult, html } from "lit";
|
import { LitElement, PropertyValues, TemplateResult, html } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
@ -16,7 +16,10 @@ import "../../../components/ha-fab";
|
|||||||
import "../../../components/ha-icon";
|
import "../../../components/ha-icon";
|
||||||
import "../../../components/ha-state-icon";
|
import "../../../components/ha-state-icon";
|
||||||
import "../../../components/ha-svg-icon";
|
import "../../../components/ha-svg-icon";
|
||||||
import { ConfigEntry, getConfigEntries } from "../../../data/config_entries";
|
import {
|
||||||
|
ConfigEntry,
|
||||||
|
subscribeConfigEntries,
|
||||||
|
} from "../../../data/config_entries";
|
||||||
import { getConfigFlowHandlers } from "../../../data/config_flow";
|
import { getConfigFlowHandlers } from "../../../data/config_flow";
|
||||||
import {
|
import {
|
||||||
EntityRegistryEntry,
|
EntityRegistryEntry,
|
||||||
@ -76,6 +79,33 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
|
|||||||
|
|
||||||
@state() private _configEntries?: Record<string, ConfigEntry>;
|
@state() private _configEntries?: Record<string, ConfigEntry>;
|
||||||
|
|
||||||
|
public hassSubscribe() {
|
||||||
|
return [
|
||||||
|
subscribeConfigEntries(
|
||||||
|
this.hass,
|
||||||
|
async (messages) => {
|
||||||
|
const newEntries = this._configEntries
|
||||||
|
? { ...this._configEntries }
|
||||||
|
: {};
|
||||||
|
messages.forEach((message) => {
|
||||||
|
if (message.type === null || message.type === "added") {
|
||||||
|
newEntries[message.entry.entry_id] = message.entry;
|
||||||
|
} else if (message.type === "removed") {
|
||||||
|
delete newEntries[message.entry.entry_id];
|
||||||
|
} else if (message.type === "updated") {
|
||||||
|
newEntries[message.entry.entry_id] = message.entry;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this._configEntries = newEntries;
|
||||||
|
},
|
||||||
|
{ type: ["helper"] }
|
||||||
|
),
|
||||||
|
subscribeEntityRegistry(this.hass.connection!, (entries) => {
|
||||||
|
this._entityEntries = groupByOne(entries, (entry) => entry.entity_id);
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
private _columns = memoizeOne(
|
private _columns = memoizeOne(
|
||||||
(narrow: boolean, localize: LocalizeFunc): DataTableColumnContainer => {
|
(narrow: boolean, localize: LocalizeFunc): DataTableColumnContainer => {
|
||||||
const columns: DataTableColumnContainer = {
|
const columns: DataTableColumnContainer = {
|
||||||
@ -256,7 +286,6 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
|
|||||||
|
|
||||||
protected firstUpdated(changedProps: PropertyValues) {
|
protected firstUpdated(changedProps: PropertyValues) {
|
||||||
super.firstUpdated(changedProps);
|
super.firstUpdated(changedProps);
|
||||||
this._getConfigEntries();
|
|
||||||
if (this.route.path === "/add") {
|
if (this.route.path === "/add") {
|
||||||
this._handleAdd();
|
this._handleAdd();
|
||||||
}
|
}
|
||||||
@ -313,9 +342,6 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
showConfigFlowDialog(this, {
|
showConfigFlowDialog(this, {
|
||||||
dialogClosedCallback: () => {
|
|
||||||
this._getConfigEntries();
|
|
||||||
},
|
|
||||||
startFlowHandler: domain,
|
startFlowHandler: domain,
|
||||||
showAdvanced: this.hass.userData?.showAdvanced,
|
showAdvanced: this.hass.userData?.showAdvanced,
|
||||||
});
|
});
|
||||||
@ -366,21 +392,6 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public hassSubscribe(): UnsubscribeFunc[] {
|
|
||||||
return [
|
|
||||||
subscribeEntityRegistry(this.hass.connection!, (entries) => {
|
|
||||||
this._entityEntries = groupByOne(entries, (entry) => entry.entity_id);
|
|
||||||
}),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
private async _getConfigEntries() {
|
|
||||||
this._configEntries = groupByOne(
|
|
||||||
await getConfigEntries(this.hass, { type: ["helper"] }),
|
|
||||||
(entry) => entry.entry_id
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private async _openEditDialog(ev: CustomEvent): Promise<void> {
|
private async _openEditDialog(ev: CustomEvent): Promise<void> {
|
||||||
const id = (ev.detail as RowClickedEvent).id;
|
const id = (ev.detail as RowClickedEvent).id;
|
||||||
if (id.includes(".")) {
|
if (id.includes(".")) {
|
||||||
@ -391,12 +402,6 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _createHelpler() {
|
private _createHelpler() {
|
||||||
showHelperDetailDialog(this, {
|
showHelperDetailDialog(this, {});
|
||||||
dialogClosedCallback: (params) => {
|
|
||||||
if (params.flowFinished) {
|
|
||||||
this._getConfigEntries();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1024,7 +1024,7 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
|
|||||||
showOptionsFlowDialog(
|
showOptionsFlowDialog(
|
||||||
this,
|
this,
|
||||||
ev.target.closest(".config_entry").configEntry,
|
ev.target.closest(".config_entry").configEntry,
|
||||||
this._manifest
|
{ manifest: this._manifest }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user