20230906.1 (#17838)

This commit is contained in:
Bram Kragten 2023-09-06 13:47:02 +02:00 committed by GitHub
commit 35496ead23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 50 additions and 43 deletions

View File

@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "home-assistant-frontend"
version = "20230906.0"
version = "20230906.1"
license = {text = "Apache-2.0"}
description = "The Home Assistant frontend"
readme = "README.md"

View File

@ -155,11 +155,12 @@ export class HaConversationAgentPicker extends LitElement {
if (!this._configEntry) {
return;
}
showOptionsFlowDialog(
this,
this._configEntry,
await fetchIntegrationManifest(this.hass, this._configEntry.domain)
);
showOptionsFlowDialog(this, this._configEntry, {
manifest: await fetchIntegrationManifest(
this.hass,
this._configEntry.domain
),
});
}
static get styles(): CSSResultGroup {

View File

@ -49,7 +49,7 @@ class FlowPreviewGroup extends LitElement {
private _setPreview = (preview: GroupPreview) => {
const now = new Date().toISOString();
this._preview = {
entity_id: `${this.stepId}.flow_preview`,
entity_id: `${this.stepId}.___flow_preview___`,
last_changed: now,
last_updated: now,
context: { id: "", parent_id: null, user_id: null },

View File

@ -110,11 +110,11 @@ class FlowPreviewTemplate extends LitElement {
</ul>
`
: !this._listeners.time
? html`<span class="all_listeners">
? html`<p class="all_listeners">
${this.hass.localize(
"ui.dialogs.helper_settings.template.no_listeners"
)}
</span>`
</p>`
: nothing} `;
}
@ -128,7 +128,7 @@ class FlowPreviewTemplate extends LitElement {
this._listeners = preview.listeners;
const now = new Date().toISOString();
this._preview = {
entity_id: `${this.stepId}.flow_preview`,
entity_id: `${this.stepId}.___flow_preview___`,
last_changed: now,
last_updated: now,
context: { id: "", parent_id: null, user_id: null },

View File

@ -1,6 +1,6 @@
import { html } from "lit";
import { ConfigEntry } from "../../data/config_entries";
import { domainToName, IntegrationManifest } from "../../data/integration";
import { domainToName } from "../../data/integration";
import {
createOptionsFlow,
deleteOptionsFlow,
@ -8,6 +8,7 @@ import {
handleOptionsFlowStep,
} from "../../data/options_flow";
import {
DataEntryFlowDialogParams,
loadDataEntryFlowDialog,
showFlowDialog,
} from "./show-dialog-data-entry-flow";
@ -17,14 +18,14 @@ export const loadOptionsFlowDialog = loadDataEntryFlowDialog;
export const showOptionsFlowDialog = (
element: HTMLElement,
configEntry: ConfigEntry,
manifest?: IntegrationManifest | null
dialogParams?: Omit<DataEntryFlowDialogParams, "flowConfig">
): void =>
showFlowDialog(
element,
{
startFlowHandler: configEntry.entry_id,
domain: configEntry.domain,
manifest,
...dialogParams,
},
{
flowType: "options_flow",

View File

@ -1336,7 +1336,7 @@ export class EntityRegistrySettingsEditor extends LitElement {
}
private async _showOptionsFlow() {
showOptionsFlowDialog(this, this.helperConfigEntry!, null);
showOptionsFlowDialog(this, this.helperConfigEntry!);
}
private _switchAsDomainsSorted = memoizeOne(

View File

@ -1,6 +1,6 @@
import "@lrnwebcomponents/simple-tooltip/simple-tooltip";
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 { customElement, property, state } from "lit/decorators";
import memoizeOne from "memoize-one";
@ -16,7 +16,10 @@ import "../../../components/ha-fab";
import "../../../components/ha-icon";
import "../../../components/ha-state-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 {
EntityRegistryEntry,
@ -76,6 +79,33 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
@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(
(narrow: boolean, localize: LocalizeFunc): DataTableColumnContainer => {
const columns: DataTableColumnContainer = {
@ -256,7 +286,6 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
protected firstUpdated(changedProps: PropertyValues) {
super.firstUpdated(changedProps);
this._getConfigEntries();
if (this.route.path === "/add") {
this._handleAdd();
}
@ -313,9 +342,6 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
return;
}
showConfigFlowDialog(this, {
dialogClosedCallback: () => {
this._getConfigEntries();
},
startFlowHandler: domain,
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> {
const id = (ev.detail as RowClickedEvent).id;
if (id.includes(".")) {
@ -391,12 +402,6 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
}
private _createHelpler() {
showHelperDetailDialog(this, {
dialogClosedCallback: (params) => {
if (params.flowFinished) {
this._getConfigEntries();
}
},
});
showHelperDetailDialog(this, {});
}
}

View File

@ -1024,7 +1024,7 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
showOptionsFlowDialog(
this,
ev.target.closest(".config_entry").configEntry,
this._manifest
{ manifest: this._manifest }
);
}