Add missing type to create device automation/script heading (#11635)

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
Joakim Sørensen 2022-02-10 10:40:34 +01:00 committed by GitHub
parent 92a9ed7080
commit b053881cef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 8 deletions

View File

@ -60,18 +60,18 @@ export class DialogDeviceAutomation extends LitElement {
return;
}
const { deviceId, script } = this._params;
const { device, script } = this._params;
fetchDeviceActions(this.hass, deviceId).then((actions) => {
fetchDeviceActions(this.hass, device.id).then((actions) => {
this._actions = actions;
});
if (script) {
return;
}
fetchDeviceTriggers(this.hass, deviceId).then((triggers) => {
fetchDeviceTriggers(this.hass, device.id).then((triggers) => {
this._triggers = triggers;
});
fetchDeviceConditions(this.hass, deviceId).then((conditions) => {
fetchDeviceConditions(this.hass, device.id).then((conditions) => {
this._conditions = conditions;
});
}
@ -88,7 +88,14 @@ export class DialogDeviceAutomation extends LitElement {
.heading=${this.hass.localize(
`ui.panel.config.devices.${
this._params.script ? "script" : "automation"
}.create`
}.create`,
{
type: this.hass.localize(
`ui.panel.config.devices.type.${
this._params.device.entry_type || "device"
}`
),
}
)}
>
<div @entry-selected=${this.closeDialog}>

View File

@ -1,7 +1,8 @@
import { fireEvent } from "../../../../common/dom/fire_event";
import { DeviceRegistryEntry } from "../../../../data/device_registry";
export interface DeviceAutomationDialogParams {
deviceId: string;
device: DeviceRegistryEntry;
script?: boolean;
}

View File

@ -812,12 +812,15 @@ export class HaConfigDevicePage extends LitElement {
}
private _showScriptDialog() {
showDeviceAutomationDialog(this, { deviceId: this.deviceId, script: true });
showDeviceAutomationDialog(this, {
device: this._device(this.deviceId, this.devices)!,
script: true,
});
}
private _showAutomationDialog() {
showDeviceAutomationDialog(this, {
deviceId: this.deviceId,
device: this._device(this.deviceId, this.devices)!,
script: false,
});
}