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:
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user