mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46: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 {
|
import {
|
||||||
mdiAbTesting,
|
mdiAbTesting,
|
||||||
|
mdiApplicationVariableOutline,
|
||||||
mdiArrowDecision,
|
mdiArrowDecision,
|
||||||
mdiCallSplit,
|
mdiCallSplit,
|
||||||
mdiCodeBraces,
|
mdiCodeBraces,
|
||||||
@ -30,4 +31,9 @@ export const ACTION_TYPES = {
|
|||||||
device_id: mdiDevices,
|
device_id: mdiDevices,
|
||||||
stop: mdiHandBackRight,
|
stop: mdiHandBackRight,
|
||||||
parallel: mdiShuffleDisabled,
|
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,
|
mdiPlay,
|
||||||
mdiPlayCircleOutline,
|
mdiPlayCircleOutline,
|
||||||
mdiRenameBox,
|
mdiRenameBox,
|
||||||
mdiStopCircleOutline,
|
|
||||||
mdiSort,
|
mdiSort,
|
||||||
|
mdiStopCircleOutline,
|
||||||
} from "@mdi/js";
|
} from "@mdi/js";
|
||||||
import { UnsubscribeFunc } from "home-assistant-js-websocket";
|
import { UnsubscribeFunc } from "home-assistant-js-websocket";
|
||||||
import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit";
|
import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit";
|
||||||
@ -25,7 +25,7 @@ import "../../../../components/ha-card";
|
|||||||
import "../../../../components/ha-expansion-panel";
|
import "../../../../components/ha-expansion-panel";
|
||||||
import "../../../../components/ha-icon-button";
|
import "../../../../components/ha-icon-button";
|
||||||
import type { HaYamlEditor } from "../../../../components/ha-yaml-editor";
|
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 { validateConfig } from "../../../../data/config";
|
||||||
import {
|
import {
|
||||||
EntityRegistryEntry,
|
EntityRegistryEntry,
|
||||||
@ -134,7 +134,9 @@ export default class HaAutomationActionRow extends LitElement {
|
|||||||
if (!changedProperties.has("action")) {
|
if (!changedProperties.has("action")) {
|
||||||
return;
|
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) {
|
if (!this._uiModeAvailable && !this._yamlMode) {
|
||||||
this._yamlMode = true;
|
this._yamlMode = true;
|
||||||
}
|
}
|
||||||
|
@ -2566,6 +2566,9 @@
|
|||||||
},
|
},
|
||||||
"parallel": {
|
"parallel": {
|
||||||
"label": "Run in parallel"
|
"label": "Run in parallel"
|
||||||
|
},
|
||||||
|
"variables": {
|
||||||
|
"label": "Define variables"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user