summaryrefslogtreecommitdiffstats
path: root/sdc-workflow-designer-ui/src/app/components/property/script-task/script-task.component.ts
diff options
context:
space:
mode:
authorYuanHu <yuan.hu1@zte.com.cn>2018-03-27 17:58:42 +0800
committerYuanHu <yuan.hu1@zte.com.cn>2018-03-27 17:58:42 +0800
commit59884c775c9d06e2195401a09e08650a5cf37b20 (patch)
tree80a2db253939f7a3aeb6e7be45c517c87d748511 /sdc-workflow-designer-ui/src/app/components/property/script-task/script-task.component.ts
parent8261a4ea8091c27b61ac581a852e2e18283b3cdd (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/script-task.component.ts')
-rw-r--r--sdc-workflow-designer-ui/src/app/components/property/script-task/script-task.component.ts35
1 files changed, 31 insertions, 4 deletions
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 = '';
+ }
+ }
+ }
}