diff options
Diffstat (limited to 'sdc-workflow-designer-ui/src/app/components/property/properties.component.ts')
-rw-r--r-- | sdc-workflow-designer-ui/src/app/components/property/properties.component.ts | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/sdc-workflow-designer-ui/src/app/components/property/properties.component.ts b/sdc-workflow-designer-ui/src/app/components/property/properties.component.ts index d3a6a416..c49b4661 100644 --- a/sdc-workflow-designer-ui/src/app/components/property/properties.component.ts +++ b/sdc-workflow-designer-ui/src/app/components/property/properties.component.ts @@ -10,13 +10,17 @@ * ZTE - initial API and implementation and/or initial documentation */ -import { AfterViewInit, Component } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; +import { TreeNode } from 'primeng/primeng'; +import { PlanTreeviewItem } from '../../model/plan-treeview-item'; +import { ValueSource } from '../../model/value-source.enum'; +import { NodeType } from '../../model/workflow/node-type.enum'; +import { Parameter } from '../../model/workflow/parameter'; import { WorkflowNode } from '../../model/workflow/workflow-node'; import { BroadcastService } from '../../services/broadcast.service'; import { JsPlumbService } from '../../services/jsplumb.service'; -import { PlanTreeviewItem } from "../../model/plan-treeview-item"; -import { ModelService } from "../../services/model.service"; +import { ModelService } from '../../services/model.service'; /** * property component presents information of a workflow node. @@ -28,23 +32,38 @@ import { ModelService } from "../../services/model.service"; styleUrls: ['./properties.component.css'], templateUrl: 'properties.component.html', }) -export class PropertiesComponent implements AfterViewInit { +export class PropertiesComponent implements OnInit { public node: WorkflowNode; + public planTreeviewItems: PlanTreeviewItem[]; + public nodeType = NodeType; + // public nodeTypes: string[] = WorkflowNodeType; public show = false; public titleEditing = false; - public planItems: PlanTreeviewItem[]; + public valueSource = [ValueSource.String]; constructor(private broadcastService: BroadcastService, - private jsPlumbService: JsPlumbService, - private modelService: ModelService) { + private modelService: ModelService, + private jsPlumbService: JsPlumbService) { } - public ngAfterViewInit() { - this.broadcastService.showProperty$.subscribe(show => this.show = show); - this.broadcastService.nodeProperty$.subscribe(node => { - this.node = node; - this.planItems = this.modelService.getPlanParameters(this.node.id); + public ngOnInit() { + this.broadcastService.showProperty$.subscribe(element => { + if (element && this.modelService.isNode(element)) { + this.node = element as WorkflowNode; + // temporarily, if config info not exists then close the property panel + // TODOS: 1) save config info in case config info no exists on a different environment. + // 2) display property panel even if config info not exists for it may be adjust. + try { + this.planTreeviewItems = this.modelService.getPlanParameters(this.node.id); + this.show = true; + } catch (error) { + this.show = false; + console.log(error); + } + } else { + this.show = false; + } }); } |