Entity registry: Translate advanced section + direct link to entity customization (#8181)

This commit is contained in:
Philip Allgaier 2021-01-27 12:35:25 +01:00 committed by GitHub
parent 8bfe583a20
commit 8d0608610f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 8 deletions

View File

@ -74,6 +74,7 @@ class HaExpansionPanel extends LitElement {
var(--divider-color, #e0e0e0) var(--divider-color, #e0e0e0)
); );
border-radius: var(--ha-card-border-radius, 4px); border-radius: var(--ha-card-border-radius, 4px);
padding: 0 8px;
} }
.summary { .summary {
@ -83,6 +84,7 @@ class HaExpansionPanel extends LitElement {
align-items: center; align-items: center;
cursor: pointer; cursor: pointer;
overflow: hidden; overflow: hidden;
font-weight: 500;
} }
.summary-icon { .summary-icon {

View File

@ -184,6 +184,21 @@ export class DialogEntityEditor extends LitElement {
>${this.hass.localize("ui.dialogs.entity_registry.faq")}</a >${this.hass.localize("ui.dialogs.entity_registry.faq")}</a
>` >`
)} )}
${this.hass.userData?.showAdvanced
? html`<br /><br />
${this.hass.localize(
"ui.dialogs.entity_registry.info_customize",
"customize_link",
html`<a
href="${"/config/customize/edit/" +
this._params!.entity_id}"
rel="noreferrer"
>${this.hass.localize(
"ui.dialogs.entity_registry.customize_link"
)}</a
>`
)}`
: ""}
</div> </div>
`; `;
case "tab-related": case "tab-related":

View File

@ -201,25 +201,37 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) {
</div> </div>
${this.entry.device_id ${this.entry.device_id
? html`<ha-expansion-panel .header=${"Advanced"}> ? html`<ha-expansion-panel
.header=${this.hass.localize(
"ui.dialogs.entity_registry.editor.advanced"
)}
outlined
>
<p> <p>
By default the entities of a device are in the same area as the ${this.hass.localize(
device. If you change the area of this entity, it will no longer "ui.dialogs.entity_registry.editor.area_note"
follow the area of the device. )}
</p> </p>
${this._areaId ${this._areaId
? html`<mwc-button @click=${this._clearArea} ? html`<mwc-button @click=${this._clearArea}
>Follow device area</mwc-button >${this.hass.localize(
"ui.dialogs.entity_registry.editor.follow_device_area"
)}</mwc-button
>` >`
: this._device : this._device
? html`<mwc-button @click=${this._openDeviceSettings} ? html`<mwc-button @click=${this._openDeviceSettings}
>Change device area</mwc-button >${this.hass.localize(
"ui.dialogs.entity_registry.editor.change_device_area"
)}</mwc-button
>` >`
: ""} : ""}
<ha-area-picker <ha-area-picker
.hass=${this.hass} .hass=${this.hass}
.value=${this._areaId} .value=${this._areaId}
.placeholder=${this._device?.area_id} .placeholder=${this._device?.area_id}
.label=${this.hass.localize(
"ui.dialogs.entity_registry.editor.area"
)}
@value-changed=${this._areaPicked} @value-changed=${this._areaPicked}
></ha-area-picker ></ha-area-picker
></ha-expansion-panel>` ></ha-expansion-panel>`
@ -377,11 +389,14 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) {
margin-right: 16px; margin-right: 16px;
} }
.row { .row {
margin-top: 8px; margin: 8px 0;
color: var(--primary-text-color); color: var(--primary-text-color);
display: flex; display: flex;
align-items: center; align-items: center;
} }
p {
margin: 8px 0;
}
`, `,
]; ];
} }

View File

@ -625,6 +625,8 @@
"dismiss": "Dismiss", "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.", "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", "faq": "documentation",
"info_customize": "You can overwrite some attributes in the {customize_link} section.",
"customize_link": "entity customizations",
"editor": { "editor": {
"name": "Name", "name": "Name",
"icon": "Icon", "icon": "Icon",
@ -641,7 +643,12 @@
"delete": "Delete", "delete": "Delete",
"confirm_delete": "Are you sure you want to delete this entry?", "confirm_delete": "Are you sure you want to delete this entry?",
"update": "Update", "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": { "helper_settings": {