diff options
Diffstat (limited to 'sdc-workflow-designer-ui/src/app/components')
13 files changed, 90 insertions, 20 deletions
diff --git a/sdc-workflow-designer-ui/src/app/components/editable-property/editable-property.component.html b/sdc-workflow-designer-ui/src/app/components/editable-property/editable-property.component.html index 080a4350..a2d9fd51 100644 --- a/sdc-workflow-designer-ui/src/app/components/editable-property/editable-property.component.html +++ b/sdc-workflow-designer-ui/src/app/components/editable-property/editable-property.component.html @@ -17,7 +17,7 @@ </span> <span class="row" *ngIf="isEditing()"> <span class="col-sm-10"> - <b4t-parameter [param]="parameter" [showLabel]="showLabel" [valueSource]= "valueSource"></b4t-parameter> + <b4t-parameter [param]="parameter" [showLabel]="showLabel" [valueSource]= "valueSource" [planItems]="planItems"></b4t-parameter> </span> <span class="col-sm-2"> <i class="fa fa-check" (click)="completeEdit()"></i> diff --git a/sdc-workflow-designer-ui/src/app/components/editable-property/editable-property.component.ts b/sdc-workflow-designer-ui/src/app/components/editable-property/editable-property.component.ts index 577a8f18..719d2a60 100644 --- a/sdc-workflow-designer-ui/src/app/components/editable-property/editable-property.component.ts +++ b/sdc-workflow-designer-ui/src/app/components/editable-property/editable-property.component.ts @@ -15,6 +15,7 @@ import { AfterViewInit, Component, EventEmitter, Input, Output } from '@angular/ import { ValueSource } from '../../model/value-source.enum'; import { ValueType } from '../../model/value-type.enum'; import { Parameter} from '../../model/workflow/parameter'; +import { PlanTreeviewItem } from "../../model/plan-treeview-item"; /** * property component presents information of a workflow node. @@ -27,6 +28,7 @@ import { Parameter} from '../../model/workflow/parameter'; }) export class EditablePropertyComponent { @Input() public parameter: Parameter; + @Input() public planItems: PlanTreeviewItem[]; @Input() public showLabel: boolean; @Input() public valueSource: ValueSource[]; @Output() public parameterChange = new EventEmitter<Parameter>(); diff --git a/sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice-detail/microservice-detail.component.ts b/sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice-detail/microservice-detail.component.ts index 3e472175..ec727293 100644 --- a/sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice-detail/microservice-detail.component.ts +++ b/sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice-detail/microservice-detail.component.ts @@ -43,8 +43,8 @@ export class MicroserviceDetailComponent implements OnChanges { } private parseSwagger2String() { - if (this.microservice.swagger) { - this.detail = JSON.stringify(this.microservice.swagger); + if (this.microservice.swaggerJson) { + this.detail = JSON.stringify(this.microservice.swaggerJson); } else { this.detail = ''; } @@ -56,10 +56,10 @@ export class MicroserviceDetailComponent implements OnChanges { const swagger = new Swagger(JSON.parse(detail)); this.detail = detail; console.log(swagger); - this.microservice.swagger = swagger; + this.microservice.swaggerJson = detail; } else { this.detail = ''; - this.microservice.swagger = null; + this.microservice.swaggerJson = null; } } catch (e) { // if detail is not a json object, then not change the swagger @@ -79,7 +79,8 @@ export class MicroserviceDetailComponent implements OnChanges { this.configService.loadDynamicInfo(this.microservice.definition) .subscribe(response => { try { - this.microservice.swagger = new Swagger(response); + + this.microservice.swaggerJson = response; this.parseSwagger2String(); } catch (e) { console.log('detail transfer error'); diff --git a/sdc-workflow-designer-ui/src/app/components/parameter-tree/parameter-tree.component.html b/sdc-workflow-designer-ui/src/app/components/parameter-tree/parameter-tree.component.html index e97968df..0a12a600 100644 --- a/sdc-workflow-designer-ui/src/app/components/parameter-tree/parameter-tree.component.html +++ b/sdc-workflow-designer-ui/src/app/components/parameter-tree/parameter-tree.component.html @@ -15,14 +15,14 @@ <p-tree *ngIf="parameters.length > 0" [value]="parameters"> <ng-template let-node pTemplate="default"> <b4t-parameter [param]="node.parameter" [canEditName]="node.keyEditable" [valueSource]= "valueSource" - (paramChange)="paramChange($event, node)"></b4t-parameter> + [planItems]="planItems" (paramChange)="paramChange($event, node)"></b4t-parameter> </ng-template> <ng-template let-node pTemplate="array"> <span *ngIf="!node.keyEditable">[Array]({{node.children.length}}) {{node.label}}:</span> <span *ngIf="node.keyEditable">[Array]({{node.children.length}}) <b4t-editable-property [parameter]="getKeyParameter(node)" [showLabel]="false" - (parameterChange)="keyParameterChange(node, $event)"></b4t-editable-property> + [planItems]="planItems" (parameterChange)="keyParameterChange(node, $event)"></b4t-editable-property> </span> <i class="fa fa-plus-square-o" (click)="addChildNode4ObjectArray(node)"></i> </ng-template> @@ -30,7 +30,7 @@ <span *ngIf="!node.keyEditable">[Object] {{node.label}}:</span> <span *ngIf="node.keyEditable">[Object] <b4t-editable-property [parameter]="getKeyParameter(node)" [showLabel]="false" - (parameterChange)="keyParameterChange(node, $event)"></b4t-editable-property>: + [planItems]="planItems" (parameterChange)="keyParameterChange(node, $event)"></b4t-editable-property>: </span> <span *ngIf="canEditValue(node)" class="dynamic-object-value"> @@ -45,7 +45,7 @@ <span *ngIf="!node.keyEditable">[Map] {{node.label}}:</span> <span *ngIf="node.keyEditable">[Map] <b4t-editable-property [parameter]="getKeyParameter(node)" [showLabel]="false" - (parameterChange)="keyParameterChange(node, $event)"></b4t-editable-property>: + [planItems]="planItems" (parameterChange)="keyParameterChange(node, $event)"></b4t-editable-property>: </span> <i *ngIf="canDelete(node)" class="fa fa-minus-square-o" (click)="deleteTreeNode(node)"></i> diff --git a/sdc-workflow-designer-ui/src/app/components/parameter-tree/parameter-tree.component.ts b/sdc-workflow-designer-ui/src/app/components/parameter-tree/parameter-tree.component.ts index f5f098b7..d0e04e39 100644 --- a/sdc-workflow-designer-ui/src/app/components/parameter-tree/parameter-tree.component.ts +++ b/sdc-workflow-designer-ui/src/app/components/parameter-tree/parameter-tree.component.ts @@ -20,6 +20,7 @@ import { RestParameter } from '../../model/workflow/rest-parameter'; import { RestTask } from '../../model/workflow/rest-task'; import { SwaggerTreeConverterService } from '../../services/swagger-tree-converter.service'; import { WorkflowUtil } from '../../util/workflow-util'; +import { PlanTreeviewItem } from "../../model/plan-treeview-item"; /** * parameter tree presents parameter of task node's input and output parameters. @@ -35,6 +36,7 @@ export class ParameterTreeComponent implements OnChanges { @Input() public task: RestTask; @Input() public defaultValueSource: string; @Input() public valueSource: ValueSource[]; + @Input() public planItems: PlanTreeviewItem[]; constructor(private swaggerTreeConverterService: SwaggerTreeConverterService) { } diff --git a/sdc-workflow-designer-ui/src/app/components/parameter/parameter.component.html b/sdc-workflow-designer-ui/src/app/components/parameter/parameter.component.html index da7dfb1d..229c5afb 100644 --- a/sdc-workflow-designer-ui/src/app/components/parameter/parameter.component.html +++ b/sdc-workflow-designer-ui/src/app/components/parameter/parameter.component.html @@ -20,9 +20,16 @@ <div [ngClass]="valueGroupClass">
<div [ngSwitch]="param.valueSource">
<input *ngSwitchCase="sourceEnum[sourceEnum.String]" [ngClass]="valueClass" class="form-control"
- type="text" [ngModel]="param.value" (ngModelChange)="modelChange($event)">
+ type="text" [ngModel]="param.value" (ngModelChange)="valueChange($event)">
<!-- TODO add plan and Top parameters -->
+ <tree-select *ngSwitchCase="sourceEnum[sourceEnum.Plan]" name="simpleSelect" [items]="planOptions"
+ childrenField="children" #simpleSelect="ngModel" [ngClass]="valueClass" class="tree-select-class"
+ [ngModel]="planValue" (ngModelChange)="valueChange($event)"></tree-select>
</div>
+ <select *ngIf="showValueSource" class="form-control col-md-3" type="text" [ngModel]="param.valueSource"
+ (ngModelChange)="valueSourceChange($event)">
+ <option *ngFor="let sourceType of valueSource" value="{{sourceEnum[sourceType]}}">{{sourceEnum[sourceType]}}</option>
+ </select>
</div>
<div *ngIf="canDelete" class="col-md-2">
<button type="button" class="btn oes-red-bg pull-right" (click)="deleteParam()">
diff --git a/sdc-workflow-designer-ui/src/app/components/parameter/parameter.component.ts b/sdc-workflow-designer-ui/src/app/components/parameter/parameter.component.ts index f42caf66..2cd5a0fd 100644 --- a/sdc-workflow-designer-ui/src/app/components/parameter/parameter.component.ts +++ b/sdc-workflow-designer-ui/src/app/components/parameter/parameter.component.ts @@ -15,6 +15,7 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { ValueSource } from '../../model/value-source.enum';
import { Parameter } from '../../model/workflow/parameter';
import { DataAccessService } from "../../services/data-access/data-access.service";
+import { PlanTreeviewItem } from "../../model/plan-treeview-item";
/**
* this component contains in property component if the corresponding node has parameter properties
@@ -30,6 +31,7 @@ export class ParameterComponent implements OnInit { @Input() public canEditName: boolean;
@Input() public showLabel = true;
@Input() public canDelete: boolean;
+ @Input() public planItems: PlanTreeviewItem[];
@Output() public paramChange = new EventEmitter<Parameter>();
@Output() delete: EventEmitter<Parameter> = new EventEmitter<Parameter>();
@@ -37,10 +39,13 @@ export class ParameterComponent implements OnInit { public valueGroupClass;
public valueClass;
public showValueSource: boolean = true;
+ public planValue: any = {};
+ public planOptions = [];
constructor(private dataAccessService: DataAccessService) { }
public ngOnInit(): void {
+ console.log(this.planItems);
if (1 === this.valueSource.length) {
this.showValueSource = false;
}
@@ -53,15 +58,58 @@ export class ParameterComponent implements OnInit { 'col-md-7': this.canDelete,
'col-md-9': !this.canDelete
};
+
+ // trans plan options to tree view items.
+ this.initPlanTreeviewItems(this.planItems);
+ if (ValueSource[ValueSource.Plan] === this.param.valueSource) {
+ this.planValue = { id: this.param.value };
+ }
}
public deleteParam(): void {
this.delete.emit();
}
- public modelChange(value: any) {
- this.param.value = value;
- this.paramChange.emit(this.param)
+ public valueSourceChange(valueSource: string) {
+ this.param.valueSource = valueSource;
+ this.valueChange(null);
+ }
+
+ public valueChange(value: any) {
+ if (ValueSource[ValueSource.Plan] === this.param.valueSource) {
+ if (value !== null && 'object' === typeof (value)) {
+ this.planValue = value;
+ } else {
+ this.planValue = {};
+ }
+ this.param.value = this.planValue.id;
+ } else {
+ this.param.value = value;
+ }
+ this.paramChange.emit(this.param);
+ }
+
+ private initPlanTreeviewItems(planTreeviewItems: PlanTreeviewItem[]): void {
+ this.planOptions = this.getTreeviewChild(planTreeviewItems);
+ }
+
+ private getTreeviewChild(planTreeviewItems: PlanTreeviewItem[]): any[] {
+ let treeviewItems = [];
+ if (undefined == planTreeviewItems || 0 === planTreeviewItems.length) {
+ // todo: debug check if it need [] or undefined.
+ return treeviewItems;
+ }
+ planTreeviewItems.forEach(item => {
+ const treeviewItem = {
+ id: item.value,
+ name: item.name,
+ disabled: false,
+ // !item.canSelect,
+ children: this.getTreeviewChild(item.children)
+ };
+ treeviewItems.push(treeviewItem);
+ });
+ return treeviewItems;
}
}
diff --git a/sdc-workflow-designer-ui/src/app/components/property/properties.component.html b/sdc-workflow-designer-ui/src/app/components/property/properties.component.html index 2ca5c690..bcc63dd0 100644 --- a/sdc-workflow-designer-ui/src/app/components/property/properties.component.html +++ b/sdc-workflow-designer-ui/src/app/components/property/properties.component.html @@ -40,5 +40,5 @@ <!-- TODO add property for different node types --> <b4t-start-event-parameters *ngIf="'startEvent' == node.type" [node]="node"></b4t-start-event-parameters> - <b4t-rest-task *ngIf="node.type == 'restTask'" [node]="node"></b4t-rest-task> + <b4t-rest-task *ngIf="node.type == 'restTask'" [node]="node" [planItems]="planItems"></b4t-rest-task> </div> 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 0630f94b..f3f784a1 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 @@ -16,6 +16,7 @@ import { WorkflowNode } from '../../model/workflow/workflow-node'; import { BroadcastService } from '../../services/broadcast.service'; import { JsPlumbService } from '../../services/jsplumb.service'; import { WorkflowService } from '../../services/workflow.service'; +import { PlanTreeviewItem } from "../../model/plan-treeview-item"; /** * property component presents information of a workflow node. @@ -31,6 +32,7 @@ export class PropertiesComponent implements AfterViewInit { public node: WorkflowNode; public show = false; public titleEditing = false; + public planItems: PlanTreeviewItem[]; constructor(private broadcastService: BroadcastService, private jsPlumnService: JsPlumbService, @@ -40,7 +42,10 @@ export class PropertiesComponent implements AfterViewInit { public ngAfterViewInit() { this.broadcastService.showProperty$.subscribe(show => this.show = show); - this.broadcastService.nodeProperty$.subscribe(node => this.node = node); + this.broadcastService.nodeProperty$.subscribe(node => { + this.node = node; + this.planItems = this.workflowService.getPlanParameters(this.node.id); + }); } public nodeNameChanged() { diff --git a/sdc-workflow-designer-ui/src/app/components/property/rest-task/rest-task-parameters/rest-task-parameters.component.html b/sdc-workflow-designer-ui/src/app/components/property/rest-task/rest-task-parameters/rest-task-parameters.component.html index 53f02f17..d13a2623 100644 --- a/sdc-workflow-designer-ui/src/app/components/property/rest-task/rest-task-parameters/rest-task-parameters.component.html +++ b/sdc-workflow-designer-ui/src/app/components/property/rest-task/rest-task-parameters/rest-task-parameters.component.html @@ -11,8 +11,8 @@ * ZTE - initial API and implementation and/or initial documentation *******************************************************************************/ --> -<b4t-parameter *ngFor="let param of requestParameters" [param]="param" [valueSource]= "inputSources"></b4t-parameter> +<b4t-parameter *ngFor="let param of requestParameters" [param]="param" [valueSource]= "inputSources" [planItems]="planItems"></b4t-parameter> <!-- body parameter --> <b4t-parameter-tree [task]="task" [parameters]="bodyParameter" [valueSource]="inputSources" - [defaultValueSource]="valueSource[valueSource.String]"></b4t-parameter-tree> + [planItems]="planItems" [defaultValueSource]="valueSource[valueSource.String]"></b4t-parameter-tree> diff --git a/sdc-workflow-designer-ui/src/app/components/property/rest-task/rest-task-parameters/rest-task-parameters.component.ts b/sdc-workflow-designer-ui/src/app/components/property/rest-task/rest-task-parameters/rest-task-parameters.component.ts index a50cc1be..31b2fd82 100644 --- a/sdc-workflow-designer-ui/src/app/components/property/rest-task/rest-task-parameters/rest-task-parameters.component.ts +++ b/sdc-workflow-designer-ui/src/app/components/property/rest-task/rest-task-parameters/rest-task-parameters.component.ts @@ -19,6 +19,7 @@ import { BroadcastService } from '../../../../services/broadcast.service'; import { RestParameter } from "../../../../model/workflow/rest-parameter"; import { ValueSource } from "../../../../model/value-source.enum"; import { SwaggerTreeConverterService } from "../../../../services/swagger-tree-converter.service"; +import { PlanTreeviewItem } from "../../../../model/plan-treeview-item"; /** * property component presents information of a workflow node. @@ -31,8 +32,9 @@ import { SwaggerTreeConverterService } from "../../../../services/swagger-tree-c }) export class RestTaskParametersComponent implements OnInit { @Input() public task: RestTask; + @Input() public planItems: PlanTreeviewItem[]; - public inputSources: ValueSource[] = [ValueSource.String]; + public inputSources: ValueSource[] = [ValueSource.String, ValueSource.Plan]; public requestParameters: RestParameter[] = []; // not include body parameter public bodyParameter: TreeNode[] = []; public responseParameter: TreeNode[] = []; diff --git a/sdc-workflow-designer-ui/src/app/components/property/rest-task/rest-task.component.html b/sdc-workflow-designer-ui/src/app/components/property/rest-task/rest-task.component.html index af428840..332811b5 100644 --- a/sdc-workflow-designer-ui/src/app/components/property/rest-task/rest-task.component.html +++ b/sdc-workflow-designer-ui/src/app/components/property/rest-task/rest-task.component.html @@ -44,5 +44,5 @@ <hr> <div class="ui-fluid"> - <b4t-rest-task-parameters [task]="node"></b4t-rest-task-parameters> + <b4t-rest-task-parameters [task]="node" [planItems]="planItems"></b4t-rest-task-parameters> </div> diff --git a/sdc-workflow-designer-ui/src/app/components/property/rest-task/rest-task.component.ts b/sdc-workflow-designer-ui/src/app/components/property/rest-task/rest-task.component.ts index 6c264646..d0c92dfd 100644 --- a/sdc-workflow-designer-ui/src/app/components/property/rest-task/rest-task.component.ts +++ b/sdc-workflow-designer-ui/src/app/components/property/rest-task/rest-task.component.ts @@ -21,6 +21,7 @@ import { WorkflowConfigService } from '../../../services/workflow-config.service import { Microservice } from "../../../model/workflow/microservice"; import { WorkflowUtil } from "../../../util/workflow-util"; import { RestParameter } from "../../../model/workflow/rest-parameter"; +import { PlanTreeviewItem } from "../../../model/plan-treeview-item"; @Component({ selector: 'b4t-rest-task', @@ -28,6 +29,8 @@ import { RestParameter } from "../../../model/workflow/rest-parameter"; }) export class RestTaskComponent implements AfterViewInit, OnInit { @Input() public node: RestTask; + @Input() public planItems: PlanTreeviewItem[]; + public swaggerJson: any = {}; public restInterfaces: any[]; public restOperations: any = []; |