good enough node editor
This commit is contained in:
1 parent
54e628481c
commit
1643558240
20 files changed
+329
-345
No files matched your search
@@ -1,36 +1,38 @@
|
||||
import { AutomationNodeTypes, AutomationNodeSubtype, AutomationNode } from "types/automations"
|
||||
import ActionChooseState from "./ActionChoose";
|
||||
import ActionDeviceState from "./ActionDevice";
|
||||
import ActionCallServiceState from "./ActionService"
|
||||
import { BaseOptionManager } from "./BaseOptionManager";
|
||||
import Generic from "./Generic";
|
||||
import { AutomationNodeTypes, AutomationNodeSubtype } from "types/automations"
|
||||
import { ActionChooseState } from "./ActionChoose";
|
||||
import { ActionDeviceState } from "./ActionDevice";
|
||||
import { ActionCallServiceState } from "./ActionService";
|
||||
import { OptionManager } from "./OptionManager";
|
||||
import { ConditionLogicState } from "./ConditionLogic";
|
||||
import { Generic } from "./Generic";
|
||||
import { ActionRepeatState } from "./ActionRepeat";
|
||||
import { ActionWaitState } from "./ActionWait";
|
||||
import { ActionEventState } from "./ActionEvent";
|
||||
|
||||
|
||||
|
||||
export const getOptionManager = <T extends AutomationNodeTypes>(
|
||||
nodeType: T,
|
||||
nodeSubtype: AutomationNodeSubtype<T>,
|
||||
) : any => {
|
||||
) : OptionManager<any> => {
|
||||
if ( nodeType === 'action') {
|
||||
switch (nodeSubtype) {
|
||||
case "choose":
|
||||
return ActionChooseState;
|
||||
case "device":
|
||||
return ActionDeviceState;
|
||||
case 'event':
|
||||
return ActionEventState;
|
||||
case "repeat":
|
||||
return ActionRepeatState;
|
||||
case 'service':
|
||||
return ActionCallServiceState;
|
||||
// case "Repeat":
|
||||
// return ScriptRepeatState;
|
||||
// case "Wait":
|
||||
// return ScriptWaitState;
|
||||
// case "Event":
|
||||
// return ScriptEventState;
|
||||
case "device":
|
||||
return ActionDeviceState;
|
||||
case "choose":
|
||||
return ActionChooseState;
|
||||
case "wait":
|
||||
return ActionWaitState;
|
||||
}
|
||||
}
|
||||
// if (nodeType === 'condition') {
|
||||
// switch (nodeSubtype) {
|
||||
// case 'Logic':
|
||||
// return ConditionLogicState
|
||||
// }
|
||||
// }
|
||||
if (nodeType === 'condition') {
|
||||
return ConditionLogicState
|
||||
}
|
||||
return Generic
|
||||
}
|
||||
Reference in new issue
Block a user