Close entity registry dialog when navigation away (#6511)

This commit is contained in:
Bram Kragten 2020-08-04 11:13:55 +02:00 committed by GitHub
parent 6991403203
commit bb5f6e88d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 5 deletions

View File

@ -97,6 +97,7 @@ export class HaRelatedItems extends SubscribeMixin(LitElement) {
</h3>
<a
href=${`/config/integrations#config_entry=${relatedConfigEntryId}`}
@click=${this._navigateAwayClose}
>
${this.hass.localize(`component.${entry.domain}.title`)}:
${entry.title}
@ -116,7 +117,10 @@ export class HaRelatedItems extends SubscribeMixin(LitElement) {
<h3>
${this.hass.localize("ui.components.related-items.device")}:
</h3>
<a href="/config/devices/device/${relatedDeviceId}">
<a
href="/config/devices/device/${relatedDeviceId}"
@click=${this._navigateAwayClose}
>
${device.name_by_user || device.name}
</a>
`;
@ -134,7 +138,10 @@ export class HaRelatedItems extends SubscribeMixin(LitElement) {
<h3>
${this.hass.localize("ui.components.related-items.area")}:
</h3>
<a href="/config/areas/area/${relatedAreaId}">
<a
href="/config/areas/area/${relatedAreaId}"
@click=${this._navigateAwayClose}
>
${area.name}
</a>
`;
@ -278,6 +285,12 @@ export class HaRelatedItems extends SubscribeMixin(LitElement) {
`;
}
private async _navigateAwayClose() {
// allow new page to open before closing dialog
await new Promise((resolve) => setTimeout(resolve, 0));
fireEvent(this, "close-dialog");
}
private async _findRelated() {
this._related = await findRelated(this.hass, this.itemType, this.itemId);
await this.updateComplete;

View File

@ -73,7 +73,7 @@ export class EntityRegistrySettings extends LitElement {
return html`
${!stateObj
? html`
<div>
<div class="container">
${this.hass!.localize(
"ui.dialogs.entity_registry.editor.unavailable"
)}
@ -81,7 +81,7 @@ export class EntityRegistrySettings extends LitElement {
`
: ""}
${this._error ? html` <div class="error">${this._error}</div> ` : ""}
<div class="form">
<div class="form container">
<paper-input
.value=${this._name}
@value-changed=${this._nameChanged}
@ -227,8 +227,10 @@ export class EntityRegistrySettings extends LitElement {
:host {
display: block;
}
.form {
.container {
padding: 20px 24px;
}
.form {
margin-bottom: 53px;
}
.buttons {