diff options
Diffstat (limited to 'sdc-workflow-designer-ui/src')
3 files changed, 20 insertions, 0 deletions
diff --git a/sdc-workflow-designer-ui/src/app/components/node/node.component.ts b/sdc-workflow-designer-ui/src/app/components/node/node.component.ts index 7a48e5dc..e78c6e8c 100644 --- a/sdc-workflow-designer-ui/src/app/components/node/node.component.ts +++ b/sdc-workflow-designer-ui/src/app/components/node/node.component.ts @@ -42,6 +42,7 @@ export class NodeComponent implements AfterViewInit, OnDestroy { ngAfterViewInit(): void {
if(this.last) {
this.jsPlumbService.initNode('.node');
+ this.jsPlumbService.connectNodes();
}
this.currentTypeSubscription = this.broadcastService.currentType$.subscribe(type => {
diff --git a/sdc-workflow-designer-ui/src/app/services/jsplumb.service.ts b/sdc-workflow-designer-ui/src/app/services/jsplumb.service.ts index 06cb2b0f..dc1d800f 100644 --- a/sdc-workflow-designer-ui/src/app/services/jsplumb.service.ts +++ b/sdc-workflow-designer-ui/src/app/services/jsplumb.service.ts @@ -15,6 +15,7 @@ import * as jsp from 'jsplumb'; import { WorkflowProcessService } from "./workflow-process.service";
import { BroadcastService } from "./broadcast.service";
import { Subscription } from 'rxjs/Subscription';
+import { WorkflowNode } from "../model/workflow/workflow-node";
/**
* JsPlumbService
@@ -139,6 +140,23 @@ export class JsPlumbService { }
+ public connectNodes() {
+ const nodes: WorkflowNode[] = this.processService.getProcess();
+ nodes.forEach(node => this.connect4OneNode(node));
+ }
+
+ public connect4OneNode(node: WorkflowNode) {
+ node.sequenceFlows.forEach(sequenceFlow => {
+ const connection = this.jsplumbInstance.connect({
+ source: sequenceFlow.sourceRef,
+ target: sequenceFlow.targetRef,
+ });
+ if (sequenceFlow.condition) {
+ connection.setLabel(sequenceFlow.condition);
+ }
+ });
+ }
+
public setLabel(sourceId: string, targetId: string, label: string) {
const sourceNode = this.processService.getNodeById(sourceId);
const connections = this.jsplumbInstance.select({ source: sourceId, target: targetId });
diff --git a/sdc-workflow-designer-ui/src/app/services/workflow.service.ts b/sdc-workflow-designer-ui/src/app/services/workflow.service.ts index 7d751923..c1eed4af 100644 --- a/sdc-workflow-designer-ui/src/app/services/workflow.service.ts +++ b/sdc-workflow-designer-ui/src/app/services/workflow.service.ts @@ -30,6 +30,7 @@ export class WorkflowService { public save(): Observable<boolean> {
console.log(this.workflow);
+ console.log(JSON.stringify(this.workflow));
return this.dataAccessService.catalogService.saveWorkflow(this.workflow);
}
}
|