stop action

This commit is contained in:
ari committed 2022-07-14 15:43:12 -04:00
1 parent 07ab4b9089
commit 8bf25547eb
7 files changed
+96 -39

No files matched your search

@@ -0,0 +1,22 @@
import InputText from "components/Inputs/InputText";
import { StopAction } from "types/automations/actions";
import { OptionManager } from "./OptionManager";
export const ActionStopState: OptionManager<StopAction> = {
defaultState: () => ({
alias: "",
stop: "",
}),
isReady: () => true,
Component: ({ state, setState }) => {
return (
<>
<InputText
label="Stop Reason"
value={state.stop ?? []}
onChange={(d) => setState({ ...state, stop: d })}
/>
</>
);
},
};
@@ -1,4 +1,4 @@
import { AutomationNodeTypes, AutomationNodeSubtype } from "types/automations"
import { AutomationNodeTypes, AutomationNodeSubtype } from "types/automations";
import { ActionChooseState } from "./ActionChoose";
import { ActionDeviceState } from "./ActionDevice";
import { ActionCallServiceState } from "./ActionService";
@@ -19,59 +19,60 @@ import { TriggerTimePattern } from "./TriggerTimePattern";
import { TriggerWebhook } from "./TriggerWebhook";
import { TriggerZone } from "./TriggerZone";
import { TriggerDevice } from "./TriggerDevice";
import { ActionStopState } from "./ActionStop";
export const getOptionManager = <T extends AutomationNodeTypes>(
nodeType: T,
nodeSubtype: AutomationNodeSubtype<T>,
nodeSubtype: AutomationNodeSubtype<T>
): OptionManager<any> => {
if (nodeType === 'action') {
if (nodeType === "action") {
switch (nodeSubtype) {
case "choose":
return ActionChooseState;
case "device":
return ActionDeviceState;
case 'event':
case "event":
return ActionEventState;
case "repeat":
return ActionRepeatState;
case 'service':
case "service":
return ActionCallServiceState;
case "wait":
return ActionWaitState;
case "stop":
return ActionStopState;
case "delay":
return ActionWaitState;
}
}
if (nodeType === 'condition') {
return ConditionLogicState
if (nodeType === "condition") {
return ConditionLogicState;
}
if (nodeType === "trigger") {
switch (nodeSubtype) {
case "event":
return TriggerEventState
return TriggerEventState;
case "homeassistant":
return TriggerHAState
return TriggerHAState;
case "mqtt":
return TriggerMQTTState
return TriggerMQTTState;
case "numeric_state":
return TriggerNumericState
return TriggerNumericState;
case "state":
return TriggerState
return TriggerState;
case "template":
return TriggerTemplate
case 'time':
return TriggerTime
case 'time_pattern':
return TriggerTimePattern
case 'webhook':
return TriggerWebhook
return TriggerTemplate;
case "time":
return TriggerTime;
case "time_pattern":
return TriggerTimePattern;
case "webhook":
return TriggerWebhook;
case "zone":
return TriggerZone
return TriggerZone;
case "device":
return TriggerDevice
return TriggerDevice;
}
}
return Generic
}
return Generic;
};