Skip to content

Commit 44fe5e9

Browse files
committed
improving editting / creating and running compositions in CFE
1 parent b4c26c7 commit 44fe5e9

File tree

6 files changed

+215
-5
lines changed

6 files changed

+215
-5
lines changed
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
{
2+
"schemaType": "flow",
3+
"schemaVersion": "0.0.1",
4+
"id": "1234",
5+
"flows": {
6+
"flow": {
7+
"flowType": "flow",
8+
"nodes": [
9+
{
10+
"id": "6be80048-6e33-41b3-9e7e-0a3235e2839a",
11+
"x": 4482.801314063679,
12+
"y": -833.6524122699388,
13+
"width": 200,
14+
"height": 100,
15+
"nodeType": "Shape",
16+
"nodeInfo": {
17+
"type": "expression",
18+
"formValues": {
19+
"expression": "input * 2",
20+
"inputType": "number"
21+
},
22+
"showFormOnlyInPopup": true,
23+
"isSettingsPopup": true,
24+
"supportsPreview": true,
25+
"taskType": "expression"
26+
}
27+
},
28+
{
29+
"id": "583d4e15-035f-4434-a082-622009b4867c",
30+
"x": 4118.548066481074,
31+
"y": -838.6024797778225,
32+
"width": 200,
33+
"height": 100,
34+
"nodeType": "Shape",
35+
"nodeInfo": {
36+
"type": "expression",
37+
"formValues": {
38+
"expression": "5",
39+
"inputType": "number"
40+
},
41+
"showFormOnlyInPopup": true,
42+
"isSettingsPopup": true,
43+
"supportsPreview": true,
44+
"taskType": "expression"
45+
}
46+
},
47+
{
48+
"id": "5dee0968-b892-48e8-9410-e23c8e0e6454",
49+
"x": 4318.548066481074,
50+
"y": -788.6024797778225,
51+
"endX": 4482.801314063679,
52+
"endY": -783.6524122699388,
53+
"startNodeId": "583d4e15-035f-4434-a082-622009b4867c",
54+
"endNodeId": "6be80048-6e33-41b3-9e7e-0a3235e2839a",
55+
"startThumbName": "output",
56+
"endThumbName": "input",
57+
"lineType": "BezierCubic",
58+
"nodeType": "Connection",
59+
"layer": 1,
60+
"nodeInfo": {}
61+
},
62+
{
63+
"id": "bb78eb2a-e697-447e-ae95-a6f717f49317",
64+
"x": 4682.801314063679,
65+
"y": -783.6524122699388,
66+
"endX": 4887.9949542124605,
67+
"endY": -780.7432085116009,
68+
"startNodeId": "6be80048-6e33-41b3-9e7e-0a3235e2839a",
69+
"endNodeId": "4eaff148-c558-4164-b9f5-8480145357cd",
70+
"startThumbName": "output",
71+
"endThumbName": "input",
72+
"lineType": "BezierCubic",
73+
"nodeType": "Connection",
74+
"layer": 1,
75+
"nodeInfo": {}
76+
},
77+
{
78+
"id": "4eaff148-c558-4164-b9f5-8480145357cd",
79+
"x": 4887.9949542124605,
80+
"y": -810.7432085116009,
81+
"width": 119.99992404343126,
82+
"height": 55.999990412421496,
83+
"nodeType": "Shape",
84+
"nodeInfo": {
85+
"type": "show-input",
86+
"formValues": {
87+
"name": "",
88+
"data-type": "default"
89+
},
90+
"initializeOnStartFlow": true,
91+
"isSettingsPopup": true,
92+
"taskType": "show-input"
93+
}
94+
}
95+
]
96+
}
97+
},
98+
"compositions": {}
99+
}
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
{
2+
"schemaType": "flow",
3+
"schemaVersion": "0.0.1",
4+
"id": "1234",
5+
"flows": {
6+
"flow": {
7+
"flowType": "flow",
8+
"nodes": [
9+
{
10+
"id": "f1defaf9-dc31-4cef-a938-2b0941b5ab93",
11+
"x": 4127.058841090634,
12+
"y": -732.7360714949607,
13+
"width": 200,
14+
"height": 100,
15+
"nodeType": "Shape",
16+
"nodeInfo": {
17+
"type": "expression",
18+
"formValues": {
19+
"expression": "\"test test\"",
20+
"inputType": "number"
21+
},
22+
"showFormOnlyInPopup": true,
23+
"isSettingsPopup": true,
24+
"supportsPreview": true,
25+
"taskType": "expression"
26+
}
27+
},
28+
{
29+
"id": "fef3ff1b-1cd8-4462-8095-b8e05865c9b2",
30+
"x": 4327.058841090634,
31+
"y": -682.7360714949607,
32+
"endX": 4445.990938002566,
33+
"endY": -683.1035811785644,
34+
"startNodeId": "f1defaf9-dc31-4cef-a938-2b0941b5ab93",
35+
"endNodeId": "8d7ed6b9-5868-4965-b44a-7ac2fcc8d259",
36+
"startThumbName": "output",
37+
"endThumbName": "input",
38+
"lineType": "BezierCubic",
39+
"nodeType": "Connection",
40+
"layer": 1,
41+
"nodeInfo": {}
42+
},
43+
{
44+
"id": "8d7ed6b9-5868-4965-b44a-7ac2fcc8d259",
45+
"x": 4445.990938002566,
46+
"y": -747.1035857841379,
47+
"width": 200.00011395493016,
48+
"height": 128.00000921114705,
49+
"nodeType": "Shape",
50+
"nodeInfo": {
51+
"type": "split-string",
52+
"formValues": {
53+
"splitBy": "SPACE"
54+
},
55+
"nodeCannotBeReplaced": false,
56+
"showFormOnlyInPopup": false,
57+
"useInCompositionOnly": false,
58+
"keepPopupOpenAfterUpdate": false,
59+
"taskType": "split-string"
60+
}
61+
},
62+
{
63+
"id": "aac5f128-df0d-461e-b873-42e06b7af7c9",
64+
"x": 4645.991051957496,
65+
"y": -683.1035811785644,
66+
"endX": 4753.1664066661315,
67+
"endY": -690.8529070774672,
68+
"startNodeId": "8d7ed6b9-5868-4965-b44a-7ac2fcc8d259",
69+
"endNodeId": "6ec7b5a1-251e-4f15-94b1-51982c5187e8",
70+
"startThumbName": "output",
71+
"endThumbName": "input",
72+
"lineType": "BezierCubic",
73+
"nodeType": "Connection",
74+
"layer": 1,
75+
"nodeInfo": {}
76+
},
77+
{
78+
"id": "6ec7b5a1-251e-4f15-94b1-51982c5187e8",
79+
"x": 4753.1664066661315,
80+
"y": -720.8529070774672,
81+
"width": 120.0000683729581,
82+
"height": 79.99999248196518,
83+
"nodeType": "Shape",
84+
"nodeInfo": {
85+
"type": "show-input",
86+
"formValues": {
87+
"name": "",
88+
"data-type": "default"
89+
},
90+
"initializeOnStartFlow": true,
91+
"isSettingsPopup": true,
92+
"taskType": "show-input"
93+
}
94+
}
95+
]
96+
}
97+
},
98+
"compositions": {}
99+
}

libs/app-canvas/src/app/app.element.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1112,6 +1112,8 @@ export class AppElement<T extends BaseNodeInfo> {
11121112

11131113
node?.update?.();
11141114
setupTasksInDropdown(selectNodeTypeHTMLElement, true, composition.id);
1115+
1116+
this.onAfterAddComposition(node);
11151117
}
11161118
};
11171119

@@ -1177,7 +1179,7 @@ export class AppElement<T extends BaseNodeInfo> {
11771179
nodeInfo?.isComposition &&
11781180
nodeInfo?.compositionId === compositionId
11791181
) {
1180-
///
1182+
// here compositions and nodes can get disconnected !!
11811183
canvasApp?.editThumbNode(thumb, node);
11821184
} else if ((node.nodeInfo as any)?.canvasAppInstance) {
11831185
this.editThumbFromComposition(
@@ -1831,6 +1833,8 @@ export class AppElement<T extends BaseNodeInfo> {
18311833
thumbOnCanvas.nodeInfo.formValues.valueType;
18321834
}
18331835
});
1836+
1837+
// WARNING : here composition and nodes can get disconnected !!!
18341838
this.editThumbFromComposition(
18351839
this.canvasApp,
18361840
composition.id,
@@ -2082,4 +2086,8 @@ export class AppElement<T extends BaseNodeInfo> {
20822086
onSetupCompositionCanvasEdit(_canvasApp: IFlowCanvasBase<T>) {
20832087
//
20842088
}
2089+
2090+
onAfterAddComposition(_node: IRectNodeComponent<T>) {
2091+
//
2092+
}
20852093
}

libs/app-canvas/src/app/flow-app.element.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2448,4 +2448,8 @@ export class FlowAppElement extends AppElement<NodeInfo> {
24482448
}
24492449
return '';
24502450
};
2451+
2452+
onAfterAddComposition(node: IRectNodeComponent<NodeInfo>) {
2453+
node?.nodeInfo?.initializeCompute?.();
2454+
}
24512455
}

libs/visual-programming-system/src/canvas-app/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,7 +1562,7 @@ export class FlowCanvas<T extends BaseNodeInfo>
15621562
updateThumbPrefixLabel(thumb.prefixLabel ?? '', c.startNodeThumb);
15631563

15641564
if (
1565-
(c.endNodeThumb?.thumbConstraint ?? '') !==
1565+
(c.startNodeThumb?.thumbConstraint ?? '') !==
15661566
getThumbConstraint(thumb.thumbConstraint)
15671567
) {
15681568
c.startNodeThumb = undefined;
@@ -1578,7 +1578,7 @@ export class FlowCanvas<T extends BaseNodeInfo>
15781578
updateThumbPrefixLabel(thumb.prefixLabel ?? '', c.endNodeThumb);
15791579

15801580
if (
1581-
(c.startNodeThumb?.thumbConstraint ?? '') !==
1581+
(c.endNodeThumb?.thumbConstraint ?? '') !==
15821582
getThumbConstraint(thumb.thumbConstraint)
15831583
) {
15841584
c.endNodeThumb = undefined;

libs/visual-programming-system/src/components/node-selector.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ export class NodeSelector<T extends BaseNodeInfo> {
552552
prefixLabel: outputNodeThumb.prefixLabel,
553553
name: outputNodeThumb.thumbName,
554554
prefixIcon: outputNodeThumb.prefixIcon,
555-
thumbConstraint: outputNodeThumb.thumbConstraint,
555+
thumbConstraint: outputNodeThumb.thumbConstraint ?? '',
556556
color: 'white',
557557
label: outputNodeThumb.thumbLabel,
558558
thumbIdentifierWithinNode: thumbIdentifierWithinNode,
@@ -609,7 +609,7 @@ export class NodeSelector<T extends BaseNodeInfo> {
609609
(connection.endNode.label ?? ''),
610610
name: inputNodeThumb.thumbName,
611611
prefixIcon: inputNodeThumb.prefixIcon,
612-
thumbConstraint: inputNodeThumb.thumbConstraint,
612+
thumbConstraint: inputNodeThumb.thumbConstraint ?? '',
613613
color: 'white',
614614
label: inputNodeThumb.thumbLabel,
615615
thumbIdentifierWithinNode: thumbIdentifierWithinNode,

0 commit comments

Comments
 (0)