diff options
author | vempo <vitaliy.emporopulo@amdocs.com> | 2018-07-24 17:34:04 +0300 |
---|---|---|
committer | vempo <vitaliy.emporopulo@amdocs.com> | 2018-07-25 11:39:10 +0300 |
commit | a52d50e788792a63e97a9176ab319d53db7a2853 (patch) | |
tree | b1c2222cacf4b8192aea16d1e0315b1f005c5347 /deprecated-workflow-designer/sdc-workflow-designer-ui/src/app/components/toolbar | |
parent | 3c2665debb400aef7f0ed9e235698d2ff9f859db (diff) |
Replaced old implementation at root
Old project files and directories has been moved
under 'deprecated-workflow-designer'. The old project
is not built by the CI anymore, but can be still built manually.
New modules/directories have been moved up and integrated with
the CI system.
Change-Id: I1528c792bcbcce9e50bfc294a1328a20e72c91cf
Issue-ID: SDC-1559
Signed-off-by: vempo <vitaliy.emporopulo@amdocs.com>
Diffstat (limited to 'deprecated-workflow-designer/sdc-workflow-designer-ui/src/app/components/toolbar')
5 files changed, 390 insertions, 0 deletions
diff --git a/deprecated-workflow-designer/sdc-workflow-designer-ui/src/app/components/toolbar/toolbar-node/toolbar-node.component.html b/deprecated-workflow-designer/sdc-workflow-designer-ui/src/app/components/toolbar/toolbar-node/toolbar-node.component.html new file mode 100644 index 00000000..25ef2258 --- /dev/null +++ b/deprecated-workflow-designer/sdc-workflow-designer-ui/src/app/components/toolbar/toolbar-node/toolbar-node.component.html @@ -0,0 +1,28 @@ +<!-- +/** + * Copyright (c) 2017 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * ZTE - initial API and implementation and/or initial documentation + */ + --> +<accordion-group *ngFor="let category of nodeCategories" [isOpen]="category.collapse" #group> + <div accordion-heading class="toolbar-head"> + <i class="fa fold-icon" [ngClass]="{'fa-chevron-down': group?.isOpen, 'fa-chevron-right': !group?.isOpen}"></i> + <i class="fa fa-th-list"></i> + <span>{{ getDisplayName(category) }}</span> + </div> + <div *ngFor="let nodeType of category.nodes"> + <div *ngIf="(nodeType.type === nodeTypeEnum[nodeTypeEnum.restTask] && supportRest) || (nodeType.type !== nodeTypeEnum[nodeTypeEnum.restTask])" + [attr.name]="getDisplayName(nodeType)" [attr.nodeTypeId]="nodeType.id" [attr.nodeType]="nodeType.type" + class="item ui-draggable"> + <img [src]="getImageUrl(nodeType)"/> + <span>{{ getDisplayName(nodeType) }}</span> + </div> + </div> +</accordion-group>
\ No newline at end of file diff --git a/deprecated-workflow-designer/sdc-workflow-designer-ui/src/app/components/toolbar/toolbar-node/toolbar-node.component.ts b/deprecated-workflow-designer/sdc-workflow-designer-ui/src/app/components/toolbar/toolbar-node/toolbar-node.component.ts new file mode 100644 index 00000000..feb94579 --- /dev/null +++ b/deprecated-workflow-designer/sdc-workflow-designer-ui/src/app/components/toolbar/toolbar-node/toolbar-node.component.ts @@ -0,0 +1,128 @@ +/** + * Copyright (c) 2017 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * ZTE - initial API and implementation and/or initial documentation + */ +import { Component, OnInit } from "@angular/core"; +import { TranslateService } from "@ngx-translate/core"; +import { NodeTypeService } from "../../../services/node-type.service"; +import { DisplayInfoService } from "../../../services/display-info.service"; +import { NodeDataType } from "../../../model/node-data-type/node-data-type"; +import { NodeType } from "../../../model/workflow/node-type.enum"; +import { JsPlumbService } from "../../../services/jsplumb.service"; +import { SettingService } from "../../../services/setting.service"; +import { WorkflowUtil } from "../../../util/workflow-util"; + +@Component({ + selector: 'wfm-toolbar-node', + templateUrl: 'toolbar-node.component.html', + styleUrls: ['../toolbar.component.css'] +}) +export class ToolbarNodeComponent implements OnInit { + public nodeCategories: any[] = []; + public nodeTypeEnum = NodeType; + public supportRest: boolean; + + private needInitButton = false; + + constructor(private nodeTypeService: NodeTypeService, + private displayInfoService: DisplayInfoService, + private jsPlumbService: JsPlumbService, + private settingService: SettingService, + public translate: TranslateService) { + + } + + public ngOnInit(): void { + this.settingService.getSetting().subscribe(setting => { + this.initSetting(setting); + this.displayInfoService.getDisplayInfo().subscribe(resp => { + this.initNodeCategories(resp); + this.needInitButton = true; + }); + }); + } + + public ngAfterViewChecked(): void { + if (this.needInitButton) { + console.log('initJsPlumb'); + this.initJsPlumb(); + this.needInitButton = false; + } + } + + private initSetting(setting: any): void { + this.supportRest = setting.supportRestNode; + } + + private initJsPlumb(): void { + this.jsPlumbService.buttonDraggable(); + this.jsPlumbService.buttonDroppable(); + } + + private initNodeCategories(displayInfo: any): void { + const defaultCategory = this.insertDefaultCategory(); + + const categoryData = displayInfo['categoryData'] || {}; + for (let key in categoryData) { + const group = { + id: key, + displayName: categoryData[key].displayName, + collapse: categoryData[key].collapse || false, + nodes: [] + }; + this.nodeCategories.push(group); + } + + const defaultNodes = displayInfo['nodes'] || {}; + for (let nodeId in defaultNodes) { + const nodeType = this.nodeTypeService.getNodeDataTypeById(nodeId); + const node = defaultNodes[nodeId]; + if (node && node.category) { + const nodeCategory = this.nodeCategories.find(category => category.id === node.category); + if (nodeCategory) { + nodeCategory.nodes.push(nodeType); + } else { + defaultCategory.nodes.push(nodeType); + } + } else { + defaultCategory.nodes.push(nodeType); + } + } + } + + private insertDefaultCategory(): any { + this.nodeCategories = []; + const defaultCategory = { + id: 'default', + displayName: { + zh_CN: '任务', + en_US: 'Task' + }, + collapse: true, + nodes: [] + }; + this.nodeCategories.push(defaultCategory); + + return defaultCategory; + } + + public getDisplayName(data: any): string { + let language = 'zh_CN'; + if (this.translate.currentLang.indexOf('en') > -1) { + language = 'en_US'; + } + return data.displayName ? data.displayName[language] : data.id; + } + + public getImageUrl(nodeType: NodeDataType): string { + const name = nodeType && nodeType.icon ? nodeType.icon.name : ''; + return WorkflowUtil.GetIconFullPath(name); + } +}
\ No newline at end of file diff --git a/deprecated-workflow-designer/sdc-workflow-designer-ui/src/app/components/toolbar/toolbar.component.css b/deprecated-workflow-designer/sdc-workflow-designer-ui/src/app/components/toolbar/toolbar.component.css new file mode 100644 index 00000000..6b0d5436 --- /dev/null +++ b/deprecated-workflow-designer/sdc-workflow-designer-ui/src/app/components/toolbar/toolbar.component.css @@ -0,0 +1,69 @@ +/** + * Copyright (c) 2017 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * ZTE - initial API and implementation and/or initial documentation + */ +.toolbar-head { + color: #404040; + font-size: 14px; +} + +.toolbar-head:hover { + cursor: pointer; +} + +.fold-icon { + width: 15px; + font-size: 8px; + color: #00abff; +} + +.item { + width: 50px; + height: 50px; + text-align: center; + float: left; + margin-left: 6px; + margin-bottom: 10px; +} + +.item:hover { + cursor: pointer; +} + +.item svg { + width: 24px; + height: 24px; + margin: 4px 13px; + display: block; + /* fill: #A9B2BA; */ + fill: #00ABFF; +} + +.item img { + width: 24px; + height: 24px; + margin: 4px 13px; + display: block; +} + +.item span { + font-size: 12px; + color: #595959; + display: block; +} + +.getway { + padding-top: 5px; +} + +.getway div { + width: 30px !important; + height: 30px !important; +}
\ No newline at end of file diff --git a/deprecated-workflow-designer/sdc-workflow-designer-ui/src/app/components/toolbar/toolbar.component.html b/deprecated-workflow-designer/sdc-workflow-designer-ui/src/app/components/toolbar/toolbar.component.html new file mode 100644 index 00000000..b8e0ae7a --- /dev/null +++ b/deprecated-workflow-designer/sdc-workflow-designer-ui/src/app/components/toolbar/toolbar.component.html @@ -0,0 +1,135 @@ +<!-- +/** + * Copyright (c) 2017 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * ZTE - initial API and implementation and/or initial documentation + */ +--> +<accordion> + <accordion-group [isOpen]="true" #event> + <div accordion-heading class="toolbar-head"> + <i class="fa fold-icon" [ngClass]="{'fa-chevron-down': event?.isOpen, 'fa-chevron-right': !event?.isOpen}"></i> + <i class="fa fa-th-list"></i> + <span>{{ 'WORKFLOW.BPMN_EVENT' | translate }}</span> + </div> + <div [attr.name]="'WORKFLOW.START_EVENT' | translate" nodeType="startEvent" class="item ui-draggable"> + <svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"> + <g> + <path class="st0" d="M15,2c7.2,0,13,5.8,13,13s-5.8,13-13,13S2,22.2,2,15S7.8,2,15,2 M15,0C6.7,0,0,6.7,0,15s6.7,15,15,15 + s15-6.7,15-15S23.3,0,15,0L15,0z" /> + </g> + </svg> + <span>{{ 'WORKFLOW.START_EVENT' | translate }}</span> + </div> + <div [attr.name]="'WORKFLOW.END_EVENT' | translate" nodeType="endEvent" class="item ui-draggable"> + <svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"> + <g> + <path class="st0" d="M15,4c6.1,0,11,4.9,11,11s-4.9,11-11,11S4,21.1,4,15S8.9,4,15,4 M15,0C6.7,0,0,6.7,0,15s6.7,15,15,15 + s15-6.7,15-15S23.3,0,15,0L15,0z" /> + </g> + </svg> + <span>{{ 'WORKFLOW.END_EVENT' | translate }}</span> + </div> + <div [attr.name]="'WORKFLOW.TIMER_EVENT' | translate" nodeType="intermediateCatchEvent" class="item ui-draggable"> + <svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"> + <g> + <path class="st0" d="M15,0C6.7,0,0,6.7,0,15c0,8.3,6.7,15,15,15c8.3,0,15-6.7,15-15C30,6.7,23.3,0,15,0z M16,27.9V26 + c0-0.6-0.4-1-1-1s-1,0.4-1,1v1.9C7.6,27.5,2.5,22.4,2.1,16H4c0.6,0,1-0.4,1-1s-0.4-1-1-1H2.1C2.5,7.6,7.6,2.5,14,2.1V4 + c0,0.6,0.4,1,1,1s1-0.4,1-1V2.1C22.4,2.5,27.5,7.6,27.9,14H26c-0.6,0-1,0.4-1,1s0.4,1,1,1h1.9C27.5,22.4,22.4,27.5,16,27.9z" + /> + <path class="st0" d="M20,14h-3.6l2.5-6.6c0.2-0.5-0.1-1.1-0.6-1.3c-0.5-0.2-1.1,0.1-1.3,0.6l-3,8c-0.1,0.3-0.1,0.7,0.1,0.9 + c0.2,0.3,0.5,0.4,0.8,0.4h5c0.6,0,1-0.4,1-1S20.6,14,20,14z" /> + </g> + </svg> + <span>{{ 'WORKFLOW.TIMER_EVENT' | translate }}</span> + </div> + <!-- + <div nodeType="errorStartEvent" class="item ui-draggable"> + <svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"> + <g> + <path class="st0" d="M15,0C6.7,0,0,6.7,0,15s6.7,15,15,15s15-6.7,15-15S23.3,0,15,0z M15,28C7.8,28,2,22.2,2,15S7.8,2,15,2 + s13,5.8,13,13S22.2,28,15,28z" /> + <path class="st0" d="M19.7,12H17l2-5.5c0.1-0.3,0.1-0.5-0.1-0.7c-0.2-0.2-0.3-0.3-0.6-0.3H14c-0.3,0-0.6,0.2-0.8,0.5L9.7,16 + c-0.1,0.3-0.1,0.5,0.1,0.7c0.2,0.2,0.3,0.3,0.6,0.3l3.6,0.1l-1,6.7c-0.1,0.3,0.2,0.8,0.5,0.9c0.1,0,0.2,0,0.3,0 + c0.3,0,0.7-0.2,0.9-0.4l5.5-11.1c0.1-0.3,0.1-0.5,0-0.8C20.2,12.1,19.9,12,19.7,12z M14.6,22.3l1.2-5.9c0-0.3,0-0.4-0.2-0.6 + c-0.2-0.2-0.3-0.3-0.6-0.3h-3.5L14.5,7h2.6l-2,5.4C15,12.8,15,13,15.2,13.2c0.2,0.2,0.3,0.3,0.6,0.3h2.5L14.6,22.3z" + /> + </g> + </svg> + <span>{{ 'WORKFLOW.ERROR_START_EVENT' | translate }}</span> + </div> + <div nodeType="errorEndEvent" class="item ui-draggable"> + <svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"> + <g> + <path class="st0" d="M15,0C6.7,0,0,6.7,0,15s6.7,15,15,15s15-6.7,15-15S23.3,0,15,0z M15,26C8.9,26,4,21.1,4,15S8.9,4,15,4 + s11,4.9,11,11S21.1,26,15,26z" /> + <path class="st0" d="M19.7,12.4H17l2-5.5c0.1-0.3,0.1-0.5-0.1-0.7c-0.2-0.2-0.3-0.3-0.6-0.3h-4.2c-0.3,0-0.6,0.2-0.8,0.5l-3.5,10 + c-0.1,0.3-0.1,0.5,0.1,0.7c0.2,0.2,0.3,0.3,0.6,0.3l3.6,0.1l-1,6.7c-0.1,0.3,0.2,0.8,0.5,0.9c0.1,0,0.2,0,0.3,0 + c0.3,0,0.7-0.2,0.9-0.4l5.5-11.1c0.1-0.3,0.1-0.5,0-0.8C20.2,12.6,20,12.4,19.7,12.4z" /> + </g> + </svg> + <span>{{ 'WORKFLOW.ERROR_END_EVENT' | translate }}</span> + </div> + --> + </accordion-group> + <accordion-group [isOpen]="true" #getway> + <div accordion-heading class="toolbar-head"> + <i class="fa fold-icon" [ngClass]="{'fa-chevron-down': getway?.isOpen, 'fa-chevron-right': !getway?.isOpen}"></i> + <i class="fa fa-th-list"></i> + <span>{{ 'WORKFLOW.BPMN_GETWAY' | translate }}</span> + </div> + <div [attr.name]="'WORKFLOW.EXCLUSIVE_GATEWAY' | translate" nodeType="exclusiveGateway" class="item ui-draggable"> + <svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"> + <g> + <path class="st0" d="M16.4,15l3.2-3.2c0.4-0.4,0.4-1,0-1.4s-1-0.4-1.4,0L15,13.6l-3.2-3.2c-0.4-0.4-1-0.4-1.4,0s-0.4,1,0,1.4 + l3.2,3.2l-3.2,3.2c-0.4,0.4-0.4,1,0,1.4s1,0.4,1.4,0l3.2-3.2l3.2,3.2c0.4,0.4,1,0.4,1.4,0s0.4-1,0-1.4L16.4,15z" + /> + <path class="st0" d="M29.1,12.9l-12-12c-1.1-1.1-3.1-1.1-4.2,0l-12,12C0.3,13.4,0,14.2,0,15s0.3,1.6,0.9,2.1l12,12 + c0.6,0.6,1.3,0.9,2.1,0.9s1.6-0.3,2.1-0.9l12-12c0.6-0.6,0.9-1.3,0.9-2.1S29.7,13.4,29.1,12.9z M27.7,15.7l-12,12 + c-0.4,0.4-1,0.4-1.4,0l-12-12C2.1,15.5,2,15.3,2,15s0.1-0.5,0.3-0.7l12-12C14.5,2.1,14.7,2,15,2s0.5,0.1,0.7,0.3l12,12 + c0.2,0.2,0.3,0.4,0.3,0.7S27.9,15.5,27.7,15.7z" /> + </g> + </svg> + <span>{{ 'WORKFLOW.EXCLUSIVE_GATEWAY' | translate }}</span> + </div> + <div [attr.name]="'WORKFLOW.PARALLEL_GATEWAY' | translate" nodeType="parallelGateway" class="item ui-draggable"> + <svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"> + <g> + <path class="st0" d="M20.5,14H16V9.5c0-0.6-0.4-1-1-1s-1,0.4-1,1V14H9.5c-0.6,0-1,0.4-1,1s0.4,1,1,1H14v4.5c0,0.6,0.4,1,1,1 + s1-0.4,1-1V16h4.5c0.6,0,1-0.4,1-1S21.1,14,20.5,14z" /> + <path class="st0" d="M29.1,12.9l-12-12c-1.1-1.1-3.1-1.1-4.2,0l-12,12C0.3,13.4,0,14.2,0,15s0.3,1.6,0.9,2.1l12,12 + c0.6,0.6,1.3,0.9,2.1,0.9s1.6-0.3,2.1-0.9l12-12c0.6-0.6,0.9-1.3,0.9-2.1S29.7,13.4,29.1,12.9z M27.7,15.7l-12,12 + c-0.4,0.4-1,0.4-1.4,0l-12-12C2.1,15.5,2,15.3,2,15s0.1-0.5,0.3-0.7l12-12C14.5,2.1,14.7,2,15,2s0.5,0.1,0.7,0.3l12,12 + c0.2,0.2,0.3,0.4,0.3,0.7S27.9,15.5,27.7,15.7z" /> + </g> + </svg> + <span>{{ 'WORKFLOW.PARALLEL_GATEWAY' | translate }}</span> + </div> + </accordion-group> + <!-- <accordion-group [isOpen]="true" #structural> + <div accordion-heading class="toolbar-head"> + <i class="fa fold-icon" [ngClass]="{'fa-chevron-down': structural?.isOpen, 'fa-chevron-right': !structural?.isOpen}"></i> + <i class="fa fa-th-list"></i> + <span>{{ 'WORKFLOW.BPMN_STRUCTURAL' | translate }}</span> + </div> + <div nodeType="subProcess" class="item ui-draggable"> + <svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"> + <g> + <path class="st0" d="M24.5,1h-18c-2.8,0-5,2.2-5,5v18c0,2.8,2.2,5,5,5h18c2.8,0,5-2.2,5-5V6C29.5,3.2,27.2,1,24.5,1z M20.2,27h-9.4 + v-9.1c0-0.3,0.2-0.5,0.5-0.5h8.4c0.3,0,0.5,0.2,0.5,0.5V27z M27.5,24c0,1.7-1.3,3-3,3h-2.3v-9.1c0-1.4-1.1-2.5-2.5-2.5h-8.4 + c-1.4,0-2.5,1.1-2.5,2.5V27H6.5c-1.7,0-3-1.3-3-3V6c0-1.7,1.3-3,3-3h18c1.7,0,3,1.3,3,3V24z"/> + <path class="st0" d="M19,21.3h-2.5v-2.5c0-0.6-0.4-1-1-1c-0.6,0-1,0.4-1,1v2.5H12c-0.6,0-1,0.4-1,1s0.4,1,1,1h2.5v2.5 + c0,0.6,0.4,1,1,1c0.6,0,1-0.4,1-1v-2.5H19c0.6,0,1-0.4,1-1S19.5,21.3,19,21.3z"/> + </g> + </svg> + <span>{{ 'WORKFLOW.SUB_PROCESS' | translate }}</span> + </div> + </accordion-group> --> + <wfm-toolbar-node></wfm-toolbar-node> +</accordion> diff --git a/deprecated-workflow-designer/sdc-workflow-designer-ui/src/app/components/toolbar/toolbar.component.ts b/deprecated-workflow-designer/sdc-workflow-designer-ui/src/app/components/toolbar/toolbar.component.ts new file mode 100644 index 00000000..bfc45094 --- /dev/null +++ b/deprecated-workflow-designer/sdc-workflow-designer-ui/src/app/components/toolbar/toolbar.component.ts @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2017 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * ZTE - initial API and implementation and/or initial documentation + */ + +import { AfterViewChecked, Component, OnInit } from '@angular/core'; + +import { SettingService } from '../../services/setting.service'; +import { BroadcastService } from '../../services/broadcast.service'; +import { JsPlumbService } from '../../services/jsplumb.service'; + +/** + * toolbar component contains some basic operations(save) and all of the supported workflow nodes. + * The supported nodes can be dragged to container component. which will add a new node to the workflow. + */ +@Component({ + selector: 'wfm-toolbar', + templateUrl: 'toolbar.component.html', + styleUrls: ['./toolbar.component.css'] +}) +export class ToolbarComponent { + +} |