- refactor for multi-config suport done

- added better errror captures
This commit is contained in:
ari committed 2022-08-16 11:40:30 -04:00
1 parent 55ea1e23a4
commit c67d1bd32f
32 files changed
+991 -835

No files matched your search

@@ -53,7 +53,7 @@ const { make, componentMeta } = makeStory({
automation: {
trigger: [],
condition: [],
sequence: [],
action: [],
},
},
},
@@ -74,7 +74,7 @@ export const Trigger = make({
},
],
condition: [],
sequence: [],
action: [],
},
});
@@ -110,7 +110,7 @@ export const Conditions = make({
below: "15",
},
],
sequence: [],
action: [],
},
});
@@ -151,7 +151,7 @@ export const FullAuto = make({
bad: "node",
} as any,
],
sequence: [
action: [
{
condition: "and",
conditions: [
@@ -269,7 +269,7 @@ export const ChooseAuto = make({
automation: {
condition: [],
trigger: [],
sequence: [
action: [
{
choose: [
{
@@ -365,7 +365,7 @@ export const EmptyChooseAuto = make({
automation: {
condition: [],
trigger: [],
sequence: [
action: [
{
choose: [],
default: [],
@@ -378,7 +378,7 @@ export const RepeatAuto = make({
automation: {
condition: [],
trigger: [],
sequence: [
action: [
{
repeat: {
while: 'states(lights.switch) == "on"',
@@ -427,7 +427,7 @@ export const ParallelAuto = make({
automation: {
condition: [],
trigger: [],
sequence: [
action: [
{
parallel: [
{
@@ -469,7 +469,7 @@ export const BadNodes = make({
{ condition: "and" },
"text?",
] as any,
sequence: [
action: [
{
parallel: {
bad: "me",
@@ -486,7 +486,7 @@ export const IfElseNode = make({
automation: {
condition: [],
trigger: [],
sequence: [
action: [
{
if: [],
else: [],
@@ -508,7 +508,7 @@ export const TimeNodes = make({
platform: "time_pattern",
},
],
sequence: [
action: [
{
condition: "time",
},
@@ -63,7 +63,7 @@ export const useAutomationNodes = (
);
outputState.extend(
makeSequenceNodes(automation.sequence, {
makeSequenceNodes(automation.action, {
...args,
state,
dims,
@@ -74,7 +74,7 @@ export const useAutomationNodes = (
dims,
true
),
nodeId: `${dims.flipped}-sequence`,
nodeId: `${dims.flipped}-action`,
nodeIndex: 2,
lastNodeId: outputState.lastNodeId,
})
@@ -98,7 +98,7 @@ export const makeSequenceNodes: ElementMaker<AutomationSequenceNode> = (
enabled: node.enabled ?? true,
label: getDescriptionFromAutomationNode(node, namer, true),
...state.getIsClosedActions(nodeId, node),
...stateUpdater.createNodeActions("sequence", nodeIndex, {
...stateUpdater.createNodeActions("action", nodeIndex, {
includeAdd: true,
flipped: dims.flipped,
}),
@@ -153,7 +153,7 @@ export const makeSequenceNodes: ElementMaker<AutomationSequenceNode> = (
dims,
{
icon: <AddIcon />,
onClick: () => stateUpdater.basic.sequence.addNode(null),
onClick: () => stateUpdater.basic.action.addNode(null),
}
),
true
@@ -261,7 +261,7 @@ export const makeChooseeNodes = makeSpecialNodeMaker(
nodeId: args.nodeId,
position: pos,
onClick: () =>
args.stateUpdater.basic.sequence.updateNode(
args.stateUpdater.basic.action.updateNode(
{
...node,
choose: [
@@ -464,10 +464,10 @@ export const makeParallelNodes = makeSpecialNodeMaker(
onClick: () =>
args.openModal({
allowedTypes: ["condition", "action"],
node: args.stateUpdater.basic.sequence.defaultNode,
node: args.stateUpdater.basic.action.defaultNode,
saveBtnCreateText: true,
update: (n) =>
args.stateUpdater.basic.sequence.updateNode(
args.stateUpdater.basic.action.updateNode(
{
...node,
parallel: [...node.parallel, n],