support for if/else
This commit is contained in:
1 parent
a1ca9d62b7
commit
bbb87ebf9e
12 files changed
+93
-11
No files matched your search
@@ -7,6 +7,7 @@ import { InputList } from "components/Inputs/InputList";
|
||||
import { Button } from "components/Inputs/Button";
|
||||
import InputBoolean from "components/Inputs/InputBoolean";
|
||||
import { useConfirm } from "material-ui-confirm";
|
||||
import { getNodeSubTypeDescription } from "./utils";
|
||||
|
||||
export interface NodeEditorProps {
|
||||
node: AutomationNode;
|
||||
@@ -96,7 +97,8 @@ export const NodeEditor: FC<NodeEditorProps> = ({
|
||||
{state.nodeType !== "condition" ? (
|
||||
<InputList
|
||||
label={state.prettyNodeType}
|
||||
current={state.subType as any}
|
||||
current={state.subType}
|
||||
getDescription={getNodeSubTypeDescription}
|
||||
options={state.subTypes}
|
||||
onChange={state.setSubType}
|
||||
prettyOptionLabels
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import { AutomationNodeSubtype } from "types/automations";
|
||||
|
||||
const subtypeDescMap: Partial<Record<AutomationNodeSubtype, string>> = {
|
||||
choose: "create conditional if/else statements",
|
||||
parallel: "run multiple nodes at the same time",
|
||||
stop: "stop the automation with a status code",
|
||||
wait: "wait based on a condition",
|
||||
repeat: "repeat a sequence until or while some conditions are met",
|
||||
device: "device related actions",
|
||||
service: "call a service",
|
||||
};
|
||||
|
||||
export const getNodeSubTypeDescription = (
|
||||
nst: AutomationNodeSubtype
|
||||
): string => {
|
||||
return subtypeDescMap[nst] ?? "";
|
||||
};
|
||||
Reference in new issue
Block a user