Allow configuration_url to point to an internal panel (#10395)

This commit is contained in:
Joakim Sørensen 2021-10-26 13:24:08 +02:00 committed by GitHub
parent 32ac04ea78
commit 63cd576d56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -195,6 +195,13 @@ export class HaConfigDevicePage extends LitElement {
: undefined;
const area = this._computeArea(this.areas, device);
const configurationUrlIsHomeAssistant =
device.configuration_url?.startsWith("homeassistant://") || false;
const configurationUrl = configurationUrlIsHomeAssistant
? device.configuration_url!.replace("homeassistant://", "/")
: device.configuration_url;
return html`
<hass-tabs-subpage
.hass=${this.hass}
@ -316,13 +323,15 @@ export class HaConfigDevicePage extends LitElement {
: html``
}
${
device.configuration_url
configurationUrl
? html`
<div class="card-actions" slot="actions">
<a
href=${device.configuration_url}
target="_blank"
href=${configurationUrl}
rel="noopener noreferrer"
.target=${configurationUrlIsHomeAssistant
? "_self"
: "_blank"}
>
<mwc-button>
${this.hass.localize(