From 82aedca7ad576e8de13cf9d313eccdde85119e9b Mon Sep 17 00:00:00 2001 From: Philip Allgaier Date: Sun, 17 Jan 2021 09:58:44 +0100 Subject: [PATCH 1/3] Entity registry: Translate advanced section + link to customize --- src/components/ha-expansion-panel.ts | 2 + .../config/entities/dialog-entity-editor.ts | 38 +++++++++++------ .../entities/entity-registry-settings.ts | 41 ++++++++++++++++--- src/translations/en.json | 9 +++- 4 files changed, 71 insertions(+), 19 deletions(-) diff --git a/src/components/ha-expansion-panel.ts b/src/components/ha-expansion-panel.ts index 83eac261d0a3..be3dc4f77dc4 100644 --- a/src/components/ha-expansion-panel.ts +++ b/src/components/ha-expansion-panel.ts @@ -74,6 +74,7 @@ class HaExpansionPanel extends LitElement { var(--divider-color, #e0e0e0) ); border-radius: var(--ha-card-border-radius, 4px); + padding: 0 8px; } .summary { @@ -83,6 +84,7 @@ class HaExpansionPanel extends LitElement { align-items: center; cursor: pointer; overflow: hidden; + font-weight: 500; } .summary-icon { diff --git a/src/panels/config/entities/dialog-entity-editor.ts b/src/panels/config/entities/dialog-entity-editor.ts index 3acd56bcadee..ad98526f40c5 100644 --- a/src/panels/config/entities/dialog-entity-editor.ts +++ b/src/panels/config/entities/dialog-entity-editor.ts @@ -171,18 +171,32 @@ export class DialogEntityEditor extends LitElement { } return html`
- ${this.hass.localize( - "ui.dialogs.entity_registry.no_unique_id", - "entity_id", - this._params!.entity_id, - "faq_link", - html`${this.hass.localize("ui.dialogs.entity_registry.faq")}` - )} +

+ ${this.hass.localize( + "ui.dialogs.entity_registry.no_unique_id", + "entity_id", + this._params!.entity_id, + "faq_link", + html`${this.hass.localize("ui.dialogs.entity_registry.faq")}` + )} +

+ ${this.hass.localize( + "ui.dialogs.entity_registry.info_customize", + "customize_link", + html`${this.hass.localize( + "ui.dialogs.entity_registry.customize_link" + )}` + )} +

`; case "tab-related": diff --git a/src/panels/config/entities/entity-registry-settings.ts b/src/panels/config/entities/entity-registry-settings.ts index 81187ab27b4c..a0779bfd3bec 100644 --- a/src/panels/config/entities/entity-registry-settings.ts +++ b/src/panels/config/entities/entity-registry-settings.ts @@ -200,26 +200,52 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) { +

+ ${this.hass.localize( + "ui.dialogs.entity_registry.info_customize", + "customize_link", + html`${this.hass.localize( + "ui.dialogs.entity_registry.customize_link" + )}` + )} +

+ ${this.entry.device_id - ? html` + ? html`

- By default the entities of a device are in the same area as the - device. If you change the area of this entity, it will no longer - follow the area of the device. + ${this.hass.localize( + "ui.dialogs.entity_registry.editor.area_note" + )}

${this._areaId ? html`Follow device area${this.hass.localize( + "ui.dialogs.entity_registry.editor.follow_device_area" + )}` : this._device ? html`Change device area${this.hass.localize( + "ui.dialogs.entity_registry.editor.change_device_area" + )}` : ""}
` @@ -382,6 +408,9 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) { display: flex; align-items: center; } + p { + margin: 8px 0; + } `, ]; } diff --git a/src/translations/en.json b/src/translations/en.json index d4b29bdeb9b4..08c046d7d009 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -621,6 +621,8 @@ "dismiss": "Dismiss", "no_unique_id": "This entity (\"{entity_id}\") does not have a unique ID, therefore its settings cannot be managed from the UI. See the {faq_link} for more detail.", "faq": "documentation", + "info_customize": "You can overwrite some attributes in the {customize_link} section.", + "customize_link": "entity customizations", "editor": { "name": "Name", "icon": "Icon", @@ -637,7 +639,12 @@ "delete": "Delete", "confirm_delete": "Are you sure you want to delete this entry?", "update": "Update", - "note": "Note: This might not work yet with all integrations." + "note": "Note: This might not work yet with all integrations.", + "advanced": "Advanced settings", + "area": "Set entity area only", + "area_note": "By default the entities of a device are in the same area as the device. If you change the area of this entity, it will no longer follow the area of the device.", + "follow_device_area": "Follow device area", + "change_device_area": "Change device area" } }, "helper_settings": { From a0182613c6b1bee0885c110b6e33f62a7c47411b Mon Sep 17 00:00:00 2001 From: Philip Allgaier Date: Sun, 17 Jan 2021 10:08:08 +0100 Subject: [PATCH 2/3] Remove not needed

--- .../config/entities/dialog-entity-editor.ts | 50 +++++++++---------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/src/panels/config/entities/dialog-entity-editor.ts b/src/panels/config/entities/dialog-entity-editor.ts index ad98526f40c5..344c4df0a7f3 100644 --- a/src/panels/config/entities/dialog-entity-editor.ts +++ b/src/panels/config/entities/dialog-entity-editor.ts @@ -171,32 +171,30 @@ export class DialogEntityEditor extends LitElement { } return html`

-

- ${this.hass.localize( - "ui.dialogs.entity_registry.no_unique_id", - "entity_id", - this._params!.entity_id, - "faq_link", - html`${this.hass.localize("ui.dialogs.entity_registry.faq")}` - )} -

- ${this.hass.localize( - "ui.dialogs.entity_registry.info_customize", - "customize_link", - html`${this.hass.localize( - "ui.dialogs.entity_registry.customize_link" - )}` - )} -

+ ${this.hass.localize( + "ui.dialogs.entity_registry.no_unique_id", + "entity_id", + this._params!.entity_id, + "faq_link", + html`${this.hass.localize("ui.dialogs.entity_registry.faq")}` + )} +

+ ${this.hass.localize( + "ui.dialogs.entity_registry.info_customize", + "customize_link", + html`${this.hass.localize( + "ui.dialogs.entity_registry.customize_link" + )}` + )}
`; case "tab-related": From 19577eef76215db551eb77ef84ecd02967f3bd33 Mon Sep 17 00:00:00 2001 From: Philip Allgaier Date: Thu, 21 Jan 2021 18:35:59 +0100 Subject: [PATCH 3/3] Show link only if no unique ID and advanced user --- .../config/entities/dialog-entity-editor.ts | 27 ++++++++++--------- .../entities/entity-registry-settings.ts | 16 +---------- 2 files changed, 16 insertions(+), 27 deletions(-) diff --git a/src/panels/config/entities/dialog-entity-editor.ts b/src/panels/config/entities/dialog-entity-editor.ts index 344c4df0a7f3..ced4f63cec06 100644 --- a/src/panels/config/entities/dialog-entity-editor.ts +++ b/src/panels/config/entities/dialog-entity-editor.ts @@ -183,18 +183,21 @@ export class DialogEntityEditor extends LitElement { >${this.hass.localize("ui.dialogs.entity_registry.faq")}` )} -

- ${this.hass.localize( - "ui.dialogs.entity_registry.info_customize", - "customize_link", - html`${this.hass.localize( - "ui.dialogs.entity_registry.customize_link" - )}` - )} + ${this.hass.userData?.showAdvanced + ? html`

+ ${this.hass.localize( + "ui.dialogs.entity_registry.info_customize", + "customize_link", + html`${this.hass.localize( + "ui.dialogs.entity_registry.customize_link" + )}` + )}` + : ""} `; case "tab-related": diff --git a/src/panels/config/entities/entity-registry-settings.ts b/src/panels/config/entities/entity-registry-settings.ts index a0779bfd3bec..6e60b08bfed8 100644 --- a/src/panels/config/entities/entity-registry-settings.ts +++ b/src/panels/config/entities/entity-registry-settings.ts @@ -200,20 +200,6 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) { -

- ${this.hass.localize( - "ui.dialogs.entity_registry.info_customize", - "customize_link", - html`${this.hass.localize( - "ui.dialogs.entity_registry.customize_link" - )}` - )} -

- ${this.entry.device_id ? html`