aboutsummaryrefslogtreecommitdiffstats
path: root/sdc-workflow-designer-ui/src/app/components/node/node.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'sdc-workflow-designer-ui/src/app/components/node/node.component.ts')
-rw-r--r--sdc-workflow-designer-ui/src/app/components/node/node.component.ts33
1 files changed, 31 insertions, 2 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 c6a95961..7a48e5dc 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
@@ -10,11 +10,12 @@
* ZTE - initial API and implementation and/or initial documentation
*/
-import { Component, AfterViewInit, Input } from '@angular/core';
+import { Component, AfterViewInit, Input, OnDestroy } from '@angular/core';
import { JsPlumbService } from '../../services/jsplumb.service';
import { BroadcastService } from "../../services/broadcast.service";
import { WorkflowNode } from "../../model/workflow/workflow-node";
+import { Subscription } from "rxjs/Subscription";
/**
* workflow node component
@@ -24,11 +25,15 @@ import { WorkflowNode } from "../../model/workflow/workflow-node";
styleUrls: ['./node.component.css'],
templateUrl: 'node.component.html',
})
-export class NodeComponent implements AfterViewInit {
+export class NodeComponent implements AfterViewInit, OnDestroy {
@Input() public node: WorkflowNode;
@Input() public last: boolean;
+ public active = false;
+ private currentTypeSubscription: Subscription;
+ private currentWorkflowSubscription: Subscription;
+
constructor(private broadcastService: BroadcastService,
private jsPlumbService: JsPlumbService) {
@@ -38,6 +43,25 @@ export class NodeComponent implements AfterViewInit {
if(this.last) {
this.jsPlumbService.initNode('.node');
}
+
+ this.currentTypeSubscription = this.broadcastService.currentType$.subscribe(type => {
+ if (type === 'SequenceFlow') {
+ this.active = false;
+ }
+ });
+
+ this.currentWorkflowSubscription = this.broadcastService.currentWorkflowNode$.subscribe(activeNode => {
+ if (activeNode.id === this.node.id) {
+ this.active = true;
+ } else {
+ this.active = false;
+ }
+ });
+ }
+
+ public ngOnDestroy() {
+ this.currentTypeSubscription.unsubscribe();
+ this.currentWorkflowSubscription.unsubscribe();
}
public showProperties() {
@@ -53,4 +77,9 @@ export class NodeComponent implements AfterViewInit {
}
}
+ public onSelected() {
+ this.broadcastService.broadcast(this.broadcastService.currentWorkflowNode, this.node);
+ this.broadcastService.broadcast(this.broadcastService.currentType, 'WorkflowNode');
+ }
+
}