Open external device configuration url to a new tab/window (#13613)

* Open external device configuration url to a new tab/window

* Remove rel in action options
This commit is contained in:
Paul Bottein 2022-09-06 12:24:03 +02:00 committed by GitHub
parent 00bc315fc1
commit 66db8c999f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -80,6 +80,7 @@ export interface EntityRegistryStateEntry extends EntityRegistryEntry {
export interface DeviceAction {
href?: string;
target?: string;
action?: (ev: any) => void;
label: string;
icon?: string;
@ -699,7 +700,15 @@ export class HaConfigDevicePage extends LitElement {
? html`
<div class="card-actions" slot="actions">
<div>
<a href=${ifDefined(firstDeviceAction!.href)}>
<a
href=${ifDefined(firstDeviceAction!.href)}
rel=${ifDefined(
firstDeviceAction!.target
? "noreferrer"
: undefined
)}
target=${ifDefined(firstDeviceAction!.target)}
>
<mwc-button
class=${ifDefined(firstDeviceAction!.classes)}
.action=${firstDeviceAction!.action}
@ -742,7 +751,15 @@ export class HaConfigDevicePage extends LitElement {
></ha-icon-button>
${actions.map(
(deviceAction) => html`
<a href=${ifDefined(deviceAction.href)}>
<a
href=${ifDefined(deviceAction.href)}
target=${ifDefined(deviceAction.target)}
rel=${ifDefined(
deviceAction.target
? "noreferrer"
: undefined
)}
>
<mwc-list-item
class=${ifDefined(
deviceAction.classes
@ -981,6 +998,7 @@ export class HaConfigDevicePage extends LitElement {
if (configurationUrl) {
deviceActions.push({
href: configurationUrl,
target: configurationUrlIsHomeAssistant ? undefined : "_blank",
icon: mdiCog,
label: this.hass.localize(
"ui.panel.config.devices.open_configuration_url"