Skip to content

Commit 64a7a42

Browse files
committed
feat: add elements with active attribute as a node
1 parent 9d2c139 commit 64a7a42

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

frank-flow/src/frontend/cypress/Frank/src/main/configurations/Example1/Configuration.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
<Configuration
22
flow:direction="vertical"
33
flow:forwardStyle="flowchart"
4-
flow:gridSize="50"
4+
flow:gridSize="50" xmlns:flow="urn:frank-flow"
55
>
66
<Adapter name="TestFrankFlow">
7-
<Receiver name="TestFrankFlow">
7+
<Receiver name="TestFrankFlow" active="false" flow:x="100" flow:y="100">
8+
<JavaListener name="TestFrankFlow" flow:x="100" flow:y="100"/>
9+
</Receiver>
10+
<Receiver name="TestFrankFlow" flow:x="400" flow:y="100">
811
<JavaListener name="TestFrankFlow" flow:x="100" flow:y="100"/>
912
</Receiver>
1013
<Pipeline>

frank-flow/src/frontend/src/app/shared/models/flow-structure-node.model.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export class FlowStructureNode {
1717
public senders: FlowStructureNode[];
1818
public path: string;
1919
public isSelfClosing: boolean;
20+
public active: boolean;
2021

2122
constructor(
2223
line: number,
@@ -40,7 +41,8 @@ export class FlowStructureNode {
4041
this.path = path;
4142

4243
this.name = this.getName();
43-
this.uid = `${this.type}(${this.name})${this.path ? `@${this.path}` : ''}`;
44+
this.active = this.getActive();
45+
this.uid = this.getUid();
4446
this.positions = this.getPositions();
4547
this.senders = [];
4648
}
@@ -54,6 +56,19 @@ export class FlowStructureNode {
5456
return this.type;
5557
}
5658

59+
private getActive(): boolean {
60+
const activeIsFalse = this.attributes['active']?.value === 'false';
61+
const activeIsEmpty = this.attributes['active']?.value === '';
62+
63+
return !(activeIsFalse || activeIsEmpty);
64+
}
65+
66+
private getUid(): string {
67+
return `${this.type}(${!this.active ? `#${this.name}#` : this.name})${
68+
this.path ? `@${this.path}` : ''
69+
}`;
70+
}
71+
5772
private getPositions(): { x: number; y: number } {
5873
let x = 0;
5974
let y = 0;

frank-flow/src/frontend/src/app/shared/workers/xml-to-flow-structure.worker.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ const charBeforeParserIsGreaterThanCharacter = () => {
9090
};
9191

9292
parser.on('opentag', (tag: TagForOptions<{}>) => {
93-
const path = unclosedNodes.map((node) => node.name).join('>');
93+
const path = unclosedNodes
94+
.map((node) => (!node.active ? `#${node.name}#` : node.name))
95+
.join('>');
9496

9597
const currentNode = new FlowStructureNode(
9698
tagStartLine,

0 commit comments

Comments
 (0)