diff options
author | 2018-03-27 17:58:42 +0800 | |
---|---|---|
committer | 2018-03-27 17:58:42 +0800 | |
commit | 59884c775c9d06e2195401a09e08650a5cf37b20 (patch) | |
tree | 80a2db253939f7a3aeb6e7be45c517c87d748511 /sdc-workflow-designer-ui/src/app/components/property/script-task | |
parent | 8261a4ea8091c27b61ac581a852e2e18283b3cdd (diff) |
Display Extend Activities on WF Designer UI.
Display Extend Activities on WF Designer UI.
Use Extend Activities to Design Workflow and Save
Issue-ID: SDC-1130,SDC-1131
Change-Id: Iea62eb0edafb2270deaac89b458015e78d961cd0
Signed-off-by: YuanHu <yuan.hu1@zte.com.cn>
Diffstat (limited to 'sdc-workflow-designer-ui/src/app/components/property/script-task')
2 files changed, 36 insertions, 9 deletions
diff --git a/sdc-workflow-designer-ui/src/app/components/property/script-task/script-task.component.html b/sdc-workflow-designer-ui/src/app/components/property/script-task/script-task.component.html index ee1ac4d4..26183210 100644 --- a/sdc-workflow-designer-ui/src/app/components/property/script-task/script-task.component.html +++ b/sdc-workflow-designer-ui/src/app/components/property/script-task/script-task.component.html @@ -15,9 +15,10 @@ <div class="form-group row"> <label class="col-md-3 form-control-label text-md-right">{{'WORKFLOW.SCRIPT_FORMAT' | translate}}</label> <div class="col-md-9"> - <select class="form-control" [(ngModel)]="node.scriptFormat"> - <option *ngFor="let script of scriptOperations" value="{{script}}">{{script}}</option> - </select> + <input *ngIf='!canChangeFormat' disabled class="form-control" [(ngModel)]="node.scriptFormat" /> + <select *ngIf='canChangeFormat' class="form-control" [(ngModel)]="node.scriptFormat"> + <option *ngFor="let script of scriptOperations" value="{{script}}">{{script}}</option> + </select> </div> </div> @@ -26,5 +27,4 @@ <div class="col-md-9"> <textarea class="form-control" type="text" rows="20" [(ngModel)]="node.script"></textarea> </div> -</div> - +</div>
\ No newline at end of file diff --git a/sdc-workflow-designer-ui/src/app/components/property/script-task/script-task.component.ts b/sdc-workflow-designer-ui/src/app/components/property/script-task/script-task.component.ts index 145768fa..a0f5fd93 100644 --- a/sdc-workflow-designer-ui/src/app/components/property/script-task/script-task.component.ts +++ b/sdc-workflow-designer-ui/src/app/components/property/script-task/script-task.component.ts @@ -9,16 +9,43 @@ * Contributors: * ZTE - initial API and implementation and/or initial documentation *******************************************************************************/ -import { AfterViewInit, Component, Input } from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; import { ScriptTask } from "../../../model/workflow/script-task"; +import { NodeTypeService } from '../../../services/node-type.service'; @Component({ - selector: 'b4t-script-task', + selector: 'wfm-script-task', templateUrl: 'script-task.component.html', }) -export class ScriptTaskComponent { +export class ScriptTaskComponent implements OnInit { @Input() public node: ScriptTask; - public scriptOperations = ['JavaScript']; + public canChangeFormat = true; + public scriptOperations = ['JavaScript', 'Groovy']; + + constructor(private nodeTypeService: NodeTypeService) { } + + public ngOnInit() { + const nodeDataType = this.nodeTypeService.getNodeDataTypeById(this.node.typeId); + let scriptFormat = nodeDataType.content.scriptFormat; + // scriptFormat is not support, reset it as null; + if (undefined === this.scriptOperations.find(format => format == scriptFormat)) { + scriptFormat = null; + } + // Defined scriptFormat value, use it as default and can not change. + if (scriptFormat && '' != scriptFormat) { + this.canChangeFormat = false; + if (!this.node.scriptFormat || '' == this.node.scriptFormat) { + this.node.scriptFormat = scriptFormat; + this.node.script = nodeDataType.content.script; + } + } else { + // Default scriptFormat value should be 'JavaScript' + if (!this.node.scriptFormat || '' == this.node.scriptFormat) { + this.node.scriptFormat = 'JavaScript'; + this.node.script = ''; + } + } + } } |