From 31e4166248f6c38801e31851149a9ecdb05e00ab Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Thu, 8 Jun 2023 10:42:26 +0200 Subject: [PATCH 1/5] Make to full integration card header clickable (#16819) --- .../integrations/ha-integration-card.ts | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/panels/config/integrations/ha-integration-card.ts b/src/panels/config/integrations/ha-integration-card.ts index a0e1aae130..5390cf6dd8 100644 --- a/src/panels/config/integrations/ha-integration-card.ts +++ b/src/panels/config/integrations/ha-integration-card.ts @@ -65,28 +65,28 @@ export class HaIntegrationCard extends LitElement { "debug-logging": Boolean(debugLoggingEnabled), })} > - - + - - - + + + ${this._renderSingleEntry()} From e3c312feaf2a6c3a112bc4ba4bdad2f236a30d74 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Thu, 8 Jun 2023 13:01:46 +0200 Subject: [PATCH 2/5] Sort related entities by name (#16821) --- src/components/ha-related-items.ts | 155 +++++++++++++++++------------ 1 file changed, 89 insertions(+), 66 deletions(-) diff --git a/src/components/ha-related-items.ts b/src/components/ha-related-items.ts index 8b53feaddf..0bed712acd 100644 --- a/src/components/ha-related-items.ts +++ b/src/components/ha-related-items.ts @@ -1,6 +1,10 @@ import "@material/mwc-list/mwc-list"; -import { mdiDevices, mdiPaletteSwatch, mdiSofa } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; +import { + mdiAlertCircleOutline, + mdiDevices, + mdiPaletteSwatch, + mdiSofa, +} from "@mdi/js"; import { css, CSSResultGroup, @@ -11,10 +15,11 @@ import { } from "lit"; import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; +import memoizeOne from "memoize-one"; import { fireEvent } from "../common/dom/fire_event"; +import { caseInsensitiveStringCompare } from "../common/string/compare"; import { Blueprints, fetchBlueprints } from "../data/blueprint"; import { ConfigEntry, getConfigEntries } from "../data/config_entries"; -import { SceneEntity } from "../data/scene"; import { findRelated, ItemType, RelatedResult } from "../data/search"; import { haStyle } from "../resources/styles"; import { HomeAssistant } from "../types"; @@ -72,13 +77,55 @@ export class HaRelatedItems extends LitElement { } } + private _relatedEntities = memoizeOne((entityIds: string[]) => + this._toEntities(entityIds) + ); + + private _relatedAutomations = memoizeOne((automationEntityIds: string[]) => + this._toEntities(automationEntityIds) + ); + + private _relatedScripts = memoizeOne((scriptEntityIds: string[]) => + this._toEntities(scriptEntityIds) + ); + + private _relatedGroups = memoizeOne((groupEntityIds: string[]) => + this._toEntities(groupEntityIds) + ); + + private _relatedScenes = memoizeOne((sceneEntityIds: string[]) => + this._toEntities(sceneEntityIds) + ); + + private _toEntities = (entityIds: string[]) => + entityIds + .map((entityId) => this.hass.states[entityId]) + .filter((entity) => entity) + .sort((a, b) => + caseInsensitiveStringCompare( + a.attributes.friendly_name ?? a.entity_id, + b.attributes.friendly_name ?? b.entity_id, + this.hass.language + ) + ); + protected render() { if (!this._related) { return nothing; } if (Object.keys(this._related).length === 0) { return html` - ${this.hass.localize("ui.components.related-items.no_related_found")} + + + + ${this.hass.localize( + "ui.components.related-items.no_related_found" + )} + + `; } return html` @@ -92,7 +139,7 @@ export class HaRelatedItems extends LitElement { (configEntry) => configEntry.entry_id === relatedConfigEntryId ); if (!entry) { - return ""; + return nothing; } return html` ` - : ""} + : nothing} ${this._related.device ? html`

${this.hass.localize("ui.components.related-items.device")} @@ -125,7 +172,7 @@ export class HaRelatedItems extends LitElement { ${this._related.device.map((relatedDeviceId) => { const device = this.hass.devices[relatedDeviceId]; if (!device) { - return ""; + return nothing; } return html` ` - : ""} + : nothing} ${this._related.area ? html`

${this.hass.localize("ui.components.related-items.area")} @@ -153,7 +200,7 @@ export class HaRelatedItems extends LitElement { >${this._related.area.map((relatedAreaId) => { const area = this.hass.areas[relatedAreaId]; if (!area) { - return ""; + return nothing; } return html` ` - : ""} + : nothing} ${this._related.entity ? html`

${this.hass.localize("ui.components.related-items.entity")}

- ${this._related.entity.map((entityId) => { - const entity: HassEntity | undefined = - this.hass.states[entityId]; - if (!entity) { - return ""; - } - return html` + ${this._relatedEntities(this._related.entity).map( + (entity) => html` @@ -208,24 +250,20 @@ export class HaRelatedItems extends LitElement { ${entity.attributes.friendly_name || entity.entity_id} - `; - })} + ` + )} ` - : ""} + : nothing} ${this._related.group ? html`

${this.hass.localize("ui.components.related-items.group")}

- ${this._related.group.map((groupId) => { - const group: HassEntity | undefined = this.hass.states[groupId]; - if (!group) { - return ""; - } - return html` + ${this._relatedGroups(this._related.group).map( + (group) => html` @@ -236,25 +274,20 @@ export class HaRelatedItems extends LitElement { ${group.attributes.friendly_name || group.entity_id} - `; - })} + ` + )} ` - : ""} + : nothing} ${this._related.scene ? html`

${this.hass.localize("ui.components.related-items.scene")}

- ${this._related.scene.map((sceneId) => { - const scene: SceneEntity | undefined = - this.hass.states[sceneId]; - if (!scene) { - return ""; - } - return html` + ${this._relatedScenes(this._related.scene).map( + (scene) => html` @@ -265,11 +298,11 @@ export class HaRelatedItems extends LitElement { ${scene.attributes.friendly_name || scene.entity_id} - `; - })} + ` + )} ` - : ""} + : nothing} ${this._related.automation_blueprint ? html`

@@ -298,23 +331,18 @@ export class HaRelatedItems extends LitElement { })} ` - : ""} + : nothing} ${this._related.automation ? html`

${this.hass.localize("ui.components.related-items.automation")}

- ${this._related.automation.map((automationId) => { - const automation: HassEntity | undefined = - this.hass.states[automationId]; - if (!automation) { - return ""; - } - return html` + ${this._relatedAutomations(this._related.automation).map( + (automation) => html` @@ -326,11 +354,11 @@ export class HaRelatedItems extends LitElement { automation.entity_id} - `; - })} + ` + )} ` - : ""} + : nothing} ${this._related.script_blueprint ? html`

@@ -359,21 +387,16 @@ export class HaRelatedItems extends LitElement { })} ` - : ""} + : nothing} ${this._related.script ? html`

${this.hass.localize("ui.components.related-items.script")}

- ${this._related.script.map((scriptId) => { - const script: HassEntity | undefined = - this.hass.states[scriptId]; - if (!script) { - return ""; - } - return html` + ${this._relatedScripts(this._related.script).map( + (script) => html` @@ -384,11 +407,11 @@ export class HaRelatedItems extends LitElement { ${script.attributes.friendly_name || script.entity_id} - `; - })} + ` + )} ` - : ""} + : nothing} `; } From 78cff3a92135544b3d7f6779bb1fc9aeeaa7d9f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Thu, 8 Jun 2023 13:13:12 +0200 Subject: [PATCH 3/5] Use menu_options instead of menu_issues for translation (#16823) --- src/panels/config/repairs/show-dialog-repair-flow.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/panels/config/repairs/show-dialog-repair-flow.ts b/src/panels/config/repairs/show-dialog-repair-flow.ts index e1af620988..b723382b80 100644 --- a/src/panels/config/repairs/show-dialog-repair-flow.ts +++ b/src/panels/config/repairs/show-dialog-repair-flow.ts @@ -217,7 +217,7 @@ export const showRepairsFlowDialog = ( return hass.localize( `component.${issue.domain}.issues.${ issue.translation_key || issue.issue_id - }.fix_flow.step.${step.step_id}.menu_issues.${option}`, + }.fix_flow.step.${step.step_id}.menu_options.${option}`, step.description_placeholders ); }, From 6d29b764d3a1f8656ee8f4160f94e011c3f8aa98 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 8 Jun 2023 14:11:52 +0200 Subject: [PATCH 4/5] Integration page fixes (#16822) --- src/panels/config/integrations/ha-config-integration-page.ts | 4 ++-- src/panels/config/integrations/ha-integration-card.ts | 2 +- src/panels/config/integrations/ha-integration-header.ts | 2 +- src/panels/config/integrations/ha-integration-list-item.ts | 2 +- src/translations/en.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/panels/config/integrations/ha-config-integration-page.ts b/src/panels/config/integrations/ha-config-integration-page.ts index 1f1e13b0cd..672b6c26a8 100644 --- a/src/panels/config/integrations/ha-config-integration-page.ts +++ b/src/panels/config/integrations/ha-config-integration-page.ts @@ -266,7 +266,7 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) { path=${mdiPackageVariant} > ${this.hass.localize( - "ui.panel.config.integrations.config_entry.provided_by_custom_integration" + "ui.panel.config.integrations.config_entry.custom_integration" )}` : ""} @@ -422,7 +422,7 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) { .flow=${flow} @click=${this._continueFlow} .label=${this.hass.localize( - "config_entry.disabled_by.config_entry" + "ui.panel.config.integrations.configure" )} > ` diff --git a/src/panels/config/integrations/ha-integration-card.ts b/src/panels/config/integrations/ha-integration-card.ts index 5390cf6dd8..9a620e3ed3 100644 --- a/src/panels/config/integrations/ha-integration-card.ts +++ b/src/panels/config/integrations/ha-integration-card.ts @@ -249,7 +249,7 @@ export class HaIntegrationCard extends LitElement { } a { text-decoration: none; - color: var(--primary-color); + color: var(--primary-text-color); } a ha-icon-button { color: var(--secondary-text-color); diff --git a/src/panels/config/integrations/ha-integration-header.ts b/src/panels/config/integrations/ha-integration-header.ts index 9aa8db3003..b151114c61 100644 --- a/src/panels/config/integrations/ha-integration-header.ts +++ b/src/panels/config/integrations/ha-integration-header.ts @@ -50,7 +50,7 @@ export class HaIntegrationHeader extends LitElement { icons.push([ mdiPackageVariant, this.hass.localize( - "ui.panel.config.integrations.config_entry.provided_by_custom_integration" + "ui.panel.config.integrations.config_entry.custom_integration" ), ]); } diff --git a/src/panels/config/integrations/ha-integration-list-item.ts b/src/panels/config/integrations/ha-integration-list-item.ts index b288f6a62d..50bf6fc363 100644 --- a/src/panels/config/integrations/ha-integration-list-item.ts +++ b/src/panels/config/integrations/ha-integration-list-item.ts @@ -84,7 +84,7 @@ export class HaIntegrationListItem extends ListItemBase { >${this.hass.localize( - "ui.panel.config.integrations.config_entry.provided_by_custom_integration" + "ui.panel.config.integrations.config_entry.custom_integration" )}` diff --git a/src/translations/en.json b/src/translations/en.json index f275796d06..a9f9608190 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -3320,7 +3320,7 @@ "device": "device" } }, - "provided_by_custom_integration": "Provided by a custom integration", + "custom_integration": "Custom integration", "depends_on_cloud": "Depends on the cloud", "yaml_only": "Needs manual configuration", "disabled_polling": "Automatic polling for updated data disabled", From 8580d3f9bf59ffbcbe4187a0d7a58cc23d9822df Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Thu, 8 Jun 2023 15:08:18 +0200 Subject: [PATCH 5/5] Bumped version to 20230608.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 8e8a23b61d..099766e91b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "home-assistant-frontend" -version = "20230607.0" +version = "20230608.0" license = {text = "Apache-2.0"} description = "The Home Assistant frontend" readme = "README.md"