mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-21 08:16:36 +00:00
Allow adding variable action in the automation UI (#16502)
This commit is contained in:
parent
72403f4276
commit
450565799e
@ -1,5 +1,6 @@
|
||||
import {
|
||||
mdiAbTesting,
|
||||
mdiApplicationVariableOutline,
|
||||
mdiArrowDecision,
|
||||
mdiCallSplit,
|
||||
mdiCodeBraces,
|
||||
@ -30,4 +31,9 @@ export const ACTION_TYPES = {
|
||||
device_id: mdiDevices,
|
||||
stop: mdiHandBackRight,
|
||||
parallel: mdiShuffleDisabled,
|
||||
};
|
||||
variables: mdiApplicationVariableOutline,
|
||||
} as const;
|
||||
|
||||
export const YAML_ONLY_ACTION_TYPES = new Set<keyof typeof ACTION_TYPES>([
|
||||
"variables",
|
||||
]);
|
||||
|
@ -8,8 +8,8 @@ import {
|
||||
mdiPlay,
|
||||
mdiPlayCircleOutline,
|
||||
mdiRenameBox,
|
||||
mdiStopCircleOutline,
|
||||
mdiSort,
|
||||
mdiStopCircleOutline,
|
||||
} from "@mdi/js";
|
||||
import { UnsubscribeFunc } from "home-assistant-js-websocket";
|
||||
import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit";
|
||||
@ -25,7 +25,7 @@ import "../../../../components/ha-card";
|
||||
import "../../../../components/ha-expansion-panel";
|
||||
import "../../../../components/ha-icon-button";
|
||||
import type { HaYamlEditor } from "../../../../components/ha-yaml-editor";
|
||||
import { ACTION_TYPES } from "../../../../data/action";
|
||||
import { ACTION_TYPES, YAML_ONLY_ACTION_TYPES } from "../../../../data/action";
|
||||
import { validateConfig } from "../../../../data/config";
|
||||
import {
|
||||
EntityRegistryEntry,
|
||||
@ -134,7 +134,9 @@ export default class HaAutomationActionRow extends LitElement {
|
||||
if (!changedProperties.has("action")) {
|
||||
return;
|
||||
}
|
||||
this._uiModeAvailable = getType(this.action) !== undefined;
|
||||
const type = getType(this.action);
|
||||
this._uiModeAvailable =
|
||||
type !== undefined && !YAML_ONLY_ACTION_TYPES.has(type as any);
|
||||
if (!this._uiModeAvailable && !this._yamlMode) {
|
||||
this._yamlMode = true;
|
||||
}
|
||||
|
@ -2566,6 +2566,9 @@
|
||||
},
|
||||
"parallel": {
|
||||
"label": "Run in parallel"
|
||||
},
|
||||
"variables": {
|
||||
"label": "Define variables"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user