summaryrefslogtreecommitdiffstats
path: root/sdc-workflow-designer-ui/src/app/services
diff options
context:
space:
mode:
authorLvbo163 <lv.bo163@zte.com.cn>2017-09-08 11:36:53 +0800
committerLvbo163 <lv.bo163@zte.com.cn>2017-09-08 11:36:53 +0800
commitc705c43cceafb81434d6eee4ced0da7024c9c008 (patch)
tree5afe3ee47e876590abdd8c4ee1af8d1afeb1be3f /sdc-workflow-designer-ui/src/app/services
parent18b2330786d193afd150bf20e4054d965259de3a (diff)
support set condition for gateway
support set condition for gateway(exclusive gateway) Issue-ID: SDC-119 Change-Id: I479ed99eb45928d90bf7361de0208eef4b113776 Signed-off-by: Lvbo163 <lv.bo163@zte.com.cn>
Diffstat (limited to 'sdc-workflow-designer-ui/src/app/services')
-rw-r--r--sdc-workflow-designer-ui/src/app/services/broadcast.service.ts7
-rw-r--r--sdc-workflow-designer-ui/src/app/services/jsplumb.service.ts27
-rw-r--r--sdc-workflow-designer-ui/src/app/services/workflow-process.service.ts10
3 files changed, 40 insertions, 4 deletions
diff --git a/sdc-workflow-designer-ui/src/app/services/broadcast.service.ts b/sdc-workflow-designer-ui/src/app/services/broadcast.service.ts
index eb87ba09..7726eae2 100644
--- a/sdc-workflow-designer-ui/src/app/services/broadcast.service.ts
+++ b/sdc-workflow-designer-ui/src/app/services/broadcast.service.ts
@@ -13,6 +13,7 @@ import { Injectable } from '@angular/core';
import { Subject } from 'rxjs/Subject';
import { WorkflowNode } from '../model/workflow/workflow-node';
+import { SequenceFlow } from "../model/workflow/sequence-flow";
/**
* BroadcastService
@@ -37,6 +38,12 @@ export class BroadcastService {
public nodeTaskChange = new Subject<WorkflowNode>();
public nodeTaskChange$ = this.nodeTaskChange.asObservable();
+ public showSequenceFlow = new Subject<boolean>();
+ public showSequenceFlow$ = this.showSequenceFlow.asObservable();
+
+ public sequenceFlow = new Subject<SequenceFlow>();
+ public sequenceFlow$ = this.sequenceFlow.asObservable();
+
/**
* broadcast datas
* this method will catch the exceptions for the broadcast
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 543b09f3..e4a9f38b 100644
--- a/sdc-workflow-designer-ui/src/app/services/jsplumb.service.ts
+++ b/sdc-workflow-designer-ui/src/app/services/jsplumb.service.ts
@@ -13,6 +13,7 @@
import { Injectable } from '@angular/core';
import * as jsp from 'jsplumb';
import { WorkflowProcessService } from "./workflow-process.service";
+import { BroadcastService } from "./broadcast.service";
/**
* JsPlumbService
@@ -22,7 +23,7 @@ import { WorkflowProcessService } from "./workflow-process.service";
export class JsPlumbService {
public jsplumbInstance;
- constructor(private processService: WorkflowProcessService) {
+ constructor(private processService: WorkflowProcessService, private broadcastService: BroadcastService) {
this.initJsPlumbInstance();
}
@@ -60,9 +61,15 @@ export class JsPlumbService {
this.jsplumbInstance.bind('connection', info => {
this.processService.addSequenceFlow(info.connection.sourceId, info.connection.targetId);
- info.connection.bind('click', connection => {
- this.jsplumbInstance.select({ connections: [connection] }).delete();
- this.processService.deleteSequenceFlow(connection.sourceId, connection.targetId);
+ // info.connection.bind('click', connection => {
+ // this.jsplumbInstance.select({ connections: [connection] }).delete();
+ // this.processService.deleteSequenceFlow(connection.sourceId, connection.targetId);
+ // });
+
+ info.connection.bind('dblclick', connection => {
+ const sequenceFlow = this.processService.getSequenceFlow(connection.sourceId, connection.targetId);
+ this.broadcastService.broadcast(this.broadcastService.sequenceFlow, sequenceFlow);
+ this.broadcastService.broadcast(this.broadcastService.showSequenceFlow, true);
});
});
@@ -93,6 +100,18 @@ export class JsPlumbService {
}
+ public setLabel(sourceId: string, targetId: string, label: string) {
+ const sourceNode = this.processService.getNodeById(sourceId);
+ const connections = this.jsplumbInstance.select({ source: sourceId, target: targetId });
+ connections.setLabel(label);
+ }
+
+ public deleteConnect(sourceId: string, targetId: string) {
+ const sourceNode = this.processService.getNodeById(sourceId);
+ const connectionSelection = this.jsplumbInstance.select({ source: sourceId, target: targetId });
+ connectionSelection.delete();
+ }
+
public remove(nodeId: string) {
this.jsplumbInstance.remove(nodeId);
}
diff --git a/sdc-workflow-designer-ui/src/app/services/workflow-process.service.ts b/sdc-workflow-designer-ui/src/app/services/workflow-process.service.ts
index 963a10b3..7f56c4af 100644
--- a/sdc-workflow-designer-ui/src/app/services/workflow-process.service.ts
+++ b/sdc-workflow-designer-ui/src/app/services/workflow-process.service.ts
@@ -95,6 +95,16 @@ export class WorkflowProcessService {
}
}
+ public getSequenceFlow(sourceRef: string, targetRef: string): SequenceFlow {
+ const node = this.getNodeById(sourceRef);
+ if (node) {
+ const sequenceFlow = node.sequenceFlows.find(tmp => tmp.targetRef === targetRef);
+ return sequenceFlow;
+ } else {
+ return undefined;
+ }
+ }
+
public getPlanParameters(nodeId: string): PlanTreeviewItem[] {
const preNodeList = new Array<WorkflowNode>();
this.getPreNodes(nodeId, preNodeList);