1
0
mirror of https://github.com/home-assistant/frontend.git synced 2025-12-20 02:38:53 +00:00

Refactor automation editor event naming for consistency (#26634)

This commit is contained in:
Philipp Waller
2025-08-21 12:23:59 +02:00
committed by GitHub
parent 5a540dd889
commit f131e93e63
2 changed files with 11 additions and 11 deletions

View File

@@ -15,16 +15,6 @@ import { migrateAutomationAction } from "./script";
export const AUTOMATION_DEFAULT_MODE: (typeof MODES)[number] = "single";
export const AUTOMATION_DEFAULT_MAX = 10;
declare global {
interface HASSDomEvents {
/**
* Dispatched to open the automation editor.
* Used by custom cards/panels to trigger the editor view.
*/
"show-automation-editor": ShowAutomationEditorParams;
}
}
export interface AutomationEntity extends HassEntityBase {
attributes: HassEntityAttributeBase & {
id?: string;

View File

@@ -7,11 +7,21 @@ import {
import type { Constructor } from "../types";
import type { HassBaseEl } from "./hass-base-mixin";
declare global {
interface HASSDomEvents {
/**
* Dispatched to open the automation editor.
* Used by custom cards/panels to trigger the editor view.
*/
"hass-automation-editor": ShowAutomationEditorParams;
}
}
export default <T extends Constructor<HassBaseEl>>(superClass: T) =>
class extends superClass {
protected firstUpdated(changedProps: PropertyValues) {
super.firstUpdated(changedProps);
this.addEventListener("show-automation-editor", (ev) =>
this.addEventListener("hass-automation-editor", (ev) =>
this._handleShowAutomationEditor(
ev as HASSDomEvent<ShowAutomationEditorParams>
)