diff options
author | Lvbo163 <lv.bo163@zte.com.cn> | 2018-01-11 19:13:03 +0800 |
---|---|---|
committer | Lvbo163 <lv.bo163@zte.com.cn> | 2018-01-11 19:13:03 +0800 |
commit | f093dcdbc4012a64c11a293052afbc74d84c8c5a (patch) | |
tree | 519bfc5640253be40a25a1dde2f071a350331f9e /sdc-workflow-designer-ui/src/app/components | |
parent | 761b385b2a0a6dbec10717e6d94f1cd1e04bb2ef (diff) |
add backend service
add data access interfaces for template data
Issue-ID: SDC-905
Change-Id: Ie632b00dbc6ede01b0ee8a3c7abdbbc1f476f1e4
Signed-off-by: Lvbo163 <lv.bo163@zte.com.cn>
Diffstat (limited to 'sdc-workflow-designer-ui/src/app/components')
32 files changed, 522 insertions, 399 deletions
diff --git a/sdc-workflow-designer-ui/src/app/components/container/container.component.css b/sdc-workflow-designer-ui/src/app/components/container/container.component.css index bc889652..5ba672cc 100644 --- a/sdc-workflow-designer-ui/src/app/components/container/container.component.css +++ b/sdc-workflow-designer-ui/src/app/components/container/container.component.css @@ -20,7 +20,16 @@ user-select: none; height: 100%; position: relative; - overflow: scroll; + overflow: auto; z-index: 0; background-color: white; } + +#node-selector{ + /* display: none; */ + position: absolute; + border: 1px dashed black; + background-color: #00ABFF; + position: absolute; + opacity: 0.1; +}
\ No newline at end of file diff --git a/sdc-workflow-designer-ui/src/app/components/container/container.component.ts b/sdc-workflow-designer-ui/src/app/components/container/container.component.ts index f35c2482..63ea84d9 100644 --- a/sdc-workflow-designer-ui/src/app/components/container/container.component.ts +++ b/sdc-workflow-designer-ui/src/app/components/container/container.component.ts @@ -16,6 +16,7 @@ import { SequenceFlow } from '../../model/workflow/sequence-flow'; import { WorkflowElement } from '../../model/workflow/workflow-element'; import { WorkflowNode } from '../../model/workflow/workflow-node'; import { BroadcastService } from '../../services/broadcast.service'; +import { DataService } from '../../services/data/data.service'; import { JsPlumbService } from '../../services/jsplumb.service'; import { ModelService } from '../../services/model.service'; @@ -39,7 +40,7 @@ export class ContainerComponent implements AfterViewChecked, AfterViewInit, OnIn private needInitSequence = false; constructor(private broadcastService: BroadcastService, private jsPlumbService: JsPlumbService, - public modelService: ModelService) { + private dataService: DataService, public modelService: ModelService) { } @HostListener('window:keyup.delete', ['$event']) ondelete(event: KeyboardEvent) { @@ -73,6 +74,9 @@ export class ContainerComponent implements AfterViewChecked, AfterViewInit, OnIn public ngOnInit() { this.jsPlumbService.initJsPlumbInstance(this.modelService.rootNodeId); + this.broadcastService.backendServiceReady$.subscribe(() => { + this.dataService.initData(); + }); this.broadcastService.planModel$.subscribe(() => { this.needInitSequence = true; }); diff --git a/sdc-workflow-designer-ui/src/app/components/menus/menus.component.html b/sdc-workflow-designer-ui/src/app/components/menus/menus.component.html index 7e043829..ee758fea 100644 --- a/sdc-workflow-designer-ui/src/app/components/menus/menus.component.html +++ b/sdc-workflow-designer-ui/src/app/components/menus/menus.component.html @@ -27,5 +27,5 @@ </button> <!-- <button type="button" class="btn white" (click)="test()">test</button> --> </div> -<b4t-microservice></b4t-microservice> +<b4t-rest-config></b4t-rest-config> <b4t-workflows></b4t-workflows> diff --git a/sdc-workflow-designer-ui/src/app/components/menus/menus.component.ts b/sdc-workflow-designer-ui/src/app/components/menus/menus.component.ts index c60e3b25..b58ec089 100644 --- a/sdc-workflow-designer-ui/src/app/components/menus/menus.component.ts +++ b/sdc-workflow-designer-ui/src/app/components/menus/menus.component.ts @@ -12,10 +12,10 @@ import { Component, OnInit, ViewChild } from '@angular/core'; import { WorkflowService } from '../../services/workflow.service'; -import { MicroserviceComponent } from "./microservice/microservice.component"; import { WorkflowsComponent } from "./workflows/workflows.component"; import { BroadcastService } from "../../services/broadcast.service"; import { PlanModel } from "../../model/plan-model"; +import { RestConfigComponent } from './rest-config/rest-config.component'; @Component({ selector: 'menus', @@ -23,9 +23,9 @@ import { PlanModel } from "../../model/plan-model"; styleUrls: ['./menus.component.css'] }) export class MenusComponent { - @ViewChild(MicroserviceComponent) public microserviceComponent: MicroserviceComponent; + @ViewChild(RestConfigComponent) public microserviceComponent: RestConfigComponent; @ViewChild(WorkflowsComponent) public workflowsComponent: WorkflowsComponent; - public currentWorkflowId : number; + public currentWorkflowId : string; public workflows = []; constructor(private broadcastService: BroadcastService, private workflowService: WorkflowService) { @@ -56,7 +56,7 @@ export class MenusComponent { this.workflowsComponent.show(); } - public workflowSelected(planId: number, planModel: PlanModel) { + public workflowSelected(planId: string, planModel: PlanModel) { this.broadcastService.broadcast(this.broadcastService.planModel, planModel); this.broadcastService.broadcast(this.broadcastService.planId, planId); diff --git a/sdc-workflow-designer-ui/src/app/components/menus/microservice/microservice-detail/microservice-detail.component.html b/sdc-workflow-designer-ui/src/app/components/menus/microservice/microservice-detail/microservice-detail.component.html deleted file mode 100644 index d13895dd..00000000 --- a/sdc-workflow-designer-ui/src/app/components/menus/microservice/microservice-detail/microservice-detail.component.html +++ /dev/null @@ -1,49 +0,0 @@ -<!-- -/** - * 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 - */ ---> -<div class="form-group row"> - <label class="col-md-2 form-control-label text-md-right">Name</label> - <div class="col-md-10"> - <input class="form-control" [(ngModel)]="microservice.name"> - </div> -</div> -<div class="form-group row"> - <label class="col-md-2 form-control-label text-md-right">version</label> - <div class="col-md-10"> - <input class="form-control" [(ngModel)]="microservice.version"> - </div> -</div> -<div class="form-group row"> - <label class="col-md-2 form-control-label text-md-right">Dynamic</label> - <div class="col-md-10"> - <p-radioButton name="dynamic" [value]=true label="true" (ngModelChange)="toggleDynamic($event)" [ngModel]="dynamic"></p-radioButton> - <p-radioButton name="dynamic" [value]=false label="false" (ngModelChange)="toggleDynamic($event)" [ngModel]="dynamic"></p-radioButton> - </div> -</div> -<div *ngIf="dynamic" class="form-group row"> - <label class="col-md-2 form-control-label text-md-right">Definition</label> - <div class="col-md-8" style="padding-right:0px"> - <input class="form-control" [(ngModel)]="microservice.url"> - </div> - <div class="col-md-2" style="padding-left:0px"> - <button class="btn" (click)="loadDynamicInfo()">load</button> - </div> -</div> - -<div class="form-group row"> - <label class="col-md-2 form-control-label text-md-right">Detail</label> - <div class="col-md-10"> - <textarea class="form-control" rows="8" [ngModel]="detail" [disabled]="dynamic" - (ngModelChange)="onDetailChanged($event)"></textarea> - </div> -</div> diff --git a/sdc-workflow-designer-ui/src/app/components/menus/microservice/microservice-detail/microservice-detail.component.ts b/sdc-workflow-designer-ui/src/app/components/menus/microservice/microservice-detail/microservice-detail.component.ts deleted file mode 100644 index c4c9649b..00000000 --- a/sdc-workflow-designer-ui/src/app/components/menus/microservice/microservice-detail/microservice-detail.component.ts +++ /dev/null @@ -1,98 +0,0 @@ -/** - * 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, Input, OnChanges, ViewChild } from '@angular/core'; -import { ModalDirective } from 'ngx-bootstrap/modal'; - -import { Swagger } from "../../../../model/swagger"; -import { RestConfig } from '../../../../model/rest-config'; -import { RestService } from '../../../../services/rest.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: 'b4t-microservice-detail', - templateUrl: 'microservice-detail.component.html', -}) -export class MicroserviceDetailComponent implements OnChanges { - @Input() microservice: RestConfig; - - public detail: string; - public dynamic = false; - - constructor(private configService: RestService) { - } - - public ngOnChanges() { - if(this.microservice == null) { - this.microservice = new RestConfig('', '', null, ''); - } - this.checkDynamic(); - this.parseSwagger2String(); - } - - private checkDynamic() { - if(this.microservice.url) { - this.dynamic = true; - } else { - this.dynamic = false; - } - } - - private parseSwagger2String() { - if (this.microservice.swagger) { - this.detail = JSON.stringify(this.microservice.swagger); - } else { - this.detail = ''; - } - } - - public onDetailChanged(detail: string) { - try { - if(detail) { - const swagger = new Swagger(JSON.parse(detail)); - this.detail = detail; - console.log(swagger); - this.microservice.swagger = swagger; - } else { - this.detail = ''; - this.microservice.swagger = null; - } - } catch (e) { - // if detail is not a json object, then not change the swagger - } - } - - public toggleDynamic(dynamic: boolean) { - this.dynamic = dynamic; - this.onDetailChanged(null); - - if(!dynamic) { - this.microservice.url = null; - } - } - - private loadDynamicInfo() { - this.configService.getDynamicSwaggerInfo(this.microservice.url) - .subscribe(response => { - try { - this.microservice.swagger = response; - this.parseSwagger2String(); - } catch (e) { - console.log('detail transfer error'); - console.error(e); - } - }); - } -} diff --git a/sdc-workflow-designer-ui/src/app/components/menus/microservice/microservice-list/microservice-list.component.html b/sdc-workflow-designer-ui/src/app/components/menus/microservice/microservice-list/microservice-list.component.html deleted file mode 100644 index ce4730f7..00000000 --- a/sdc-workflow-designer-ui/src/app/components/menus/microservice/microservice-list/microservice-list.component.html +++ /dev/null @@ -1,32 +0,0 @@ -<!-- -/** - * 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 - */ ---> -<div class="scroll" style="overflow:hidden; max-height: 300px; height: 300px;"> - <div class="card"> - <div class="card-header d-flex justify-content-between align-items-center"> - <span>Config List</span> - <span class="badge badge-success badge-pill" (click)="addMicroservice()"><i class="fa fa-plus"></i></span> - </div> - - <ul class="list-group"> - <li class="list-group-item d-flex justify-content-between align-items-center" - *ngFor="let microservice of microservices; index as i"> - <div (click)="onMicroserviceSelected(microservice)">{{microservice.name}}</div> - <div class="badge badge-danger badge-pill" (click)="deleteMicroservice(i, microservice)"> - <i class="fa fa-minus"></i> - </div> - </li> - </ul> - </div> -</div> - diff --git a/sdc-workflow-designer-ui/src/app/components/menus/microservice/microservice-list/microservice-list.component.ts b/sdc-workflow-designer-ui/src/app/components/menus/microservice/microservice-list/microservice-list.component.ts deleted file mode 100644 index 6b17f8b7..00000000 --- a/sdc-workflow-designer-ui/src/app/components/menus/microservice/microservice-list/microservice-list.component.ts +++ /dev/null @@ -1,80 +0,0 @@ -/** - * 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, EventEmitter, Input, Output, ViewChild } from '@angular/core'; -import { ModalDirective } from 'ngx-bootstrap/modal'; - -import { RestConfig } from '../../../../model/rest-config'; - -/** - * 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: 'b4t-microservice-list', - templateUrl: 'microservice-list.component.html', -}) -export class MicroserviceListComponent { - @Input() microservices: RestConfig[]; - @Output() microserviceSelected = new EventEmitter<RestConfig>(); - - public onMicroserviceSelected(microservice: RestConfig) { - this.microserviceSelected.emit(microservice); - } - - public addMicroservice() { - const microservice = new RestConfig(this.getConfigId(), 'new microservice', '', null); - this.microservices.push(microservice); - - this.onMicroserviceSelected(microservice); - } - - public deleteMicroservice(index: number, microservice: RestConfig) { - this.deleteMicroService(microservice.name, microservice.version); - - // set the next microservice selected - let selectedMicroservice; - if (this.microservices.length > 0) { - if (this.microservices[index]) { - selectedMicroservice = this.microservices[index]; - } else { - selectedMicroservice = this.microservices[index - 1]; - } - } - this.onMicroserviceSelected(selectedMicroservice); - } - - private deleteMicroService(name: string, version: string) { - const index = this.microservices.findIndex(service => (service.name === name && service.version === version)); - if(index !== -1) { - return this.microservices.splice(index, 1)[0]; - } - - return undefined; - } - - private getConfigId(): string { - const idSet = new Set<string>(); - this.microservices.forEach(config => { - idSet.add(config.id); - }); - - for(let index = 0; index < idSet.size; index++) { - const id = `config${index}`; - if(!idSet.has(id)) { - return id; - } - } - - return `config0`; - } -} diff --git a/sdc-workflow-designer-ui/src/app/components/menus/microservice/microservice.component.html b/sdc-workflow-designer-ui/src/app/components/menus/microservice/microservice.component.html deleted file mode 100644 index e8483c22..00000000 --- a/sdc-workflow-designer-ui/src/app/components/menus/microservice/microservice.component.html +++ /dev/null @@ -1,39 +0,0 @@ -<!-- -/** - * 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 - */ ---> -<div class="modal fade" bsModal #microserviceModal="bs-modal" [config]="{backdrop: 'static'}" - tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true"> - <div class="modal-dialog modal-lg"> - <div class="modal-content"> - <div class="modal-header"> - <h4 class="modal-title pull-left">microservice Setting</h4> - <button type="button" class="close pull-right" aria-label="Close" (click)="microserviceModal.hide()"> - <span aria-hidden="true">×</span> - </button> - </div> - <div class="modal-body"> - <div class="row"> - <div class="col-sm-4"> - <b4t-microservice-list [microservices]="microservices" (microserviceSelected)="microserviceSelected($event)"></b4t-microservice-list> - </div> - <div class="col-sm-8"> - <b4t-microservice-detail [microservice]="currentMicroservice"></b4t-microservice-detail> - </div> - </div> - </div> - <div class="modal-footer"> - <button type="button" class="btn over-grey" (click)="microserviceModal.hide()">close</button> - </div> - </div> - </div> -</div> diff --git a/sdc-workflow-designer-ui/src/app/components/menus/microservice/microservice.component.ts b/sdc-workflow-designer-ui/src/app/components/menus/microservice/microservice.component.ts deleted file mode 100644 index 5c659313..00000000 --- a/sdc-workflow-designer-ui/src/app/components/menus/microservice/microservice.component.ts +++ /dev/null @@ -1,46 +0,0 @@ -/** - * 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 { AfterViewInit, Component, ViewChild } from '@angular/core'; -import { ModalDirective } from 'ngx-bootstrap/modal'; - -import { MicroserviceListComponent } from './microservice-list/microservice-list.component'; -import { RestService } from '../../../services/rest.service'; -import { RestConfig } from '../../../model/rest-config'; - -/** - * microservice component - * open a model to set microservice info - */ -@Component({ - selector: 'b4t-microservice', - templateUrl: 'microservice.component.html', -}) -export class MicroserviceComponent { - @ViewChild('microserviceModal') public microserviceModal: ModalDirective; - - public microservices: RestConfig[]; - public currentMicroservice: RestConfig; - - constructor(private restService: RestService) { - } - - public microserviceSelected(microservice: any) { - this.currentMicroservice = microservice; - } - - public show() { - this.microservices = this.restService.getRestConfigs(); - this.microserviceModal.show(); - } - -} diff --git a/sdc-workflow-designer-ui/src/app/components/menus/rest-config/rest-config-detail/rest-config-detail.component.html b/sdc-workflow-designer-ui/src/app/components/menus/rest-config/rest-config-detail/rest-config-detail.component.html new file mode 100644 index 00000000..ea0d3c68 --- /dev/null +++ b/sdc-workflow-designer-ui/src/app/components/menus/rest-config/rest-config-detail/rest-config-detail.component.html @@ -0,0 +1,35 @@ +<div class="form-group row"> + <label class="col-md-2 form-control-label text-md-right">Name</label> + <div class="col-md-10"> + <input class="form-control" [(ngModel)]="restConfig.name"> + </div> +</div> +<div class="form-group row"> + <label class="col-md-2 form-control-label text-md-right">BaseUrl</label> + <div class="col-md-10"> + <input class="form-control" [(ngModel)]="restConfig.url"> + </div> +</div> +<div class="form-group row"> + <label class="col-md-2 form-control-label text-md-right">Definition</label> + <div class="col-md-10"> + <input class="form-control" [(ngModel)]="restConfig.definition"> + </div> +</div> +<div class="form-group row"> + <label class="col-md-2 form-control-label text-md-right">Dynamic</label> + <div class="col-md-10"> + <p-radioButton name="dynamic" [value]=true label="true" (ngModelChange)="toggleDynamic($event)" + [ngModel]="restConfig.dynamic"></p-radioButton> + <p-radioButton name="dynamic" [value]=false label="false" (ngModelChange)="toggleDynamic($event)" + [ngModel]="restConfig.dynamic"></p-radioButton> + </div> +</div> +<div class="form-group row"> + <label class="col-md-2 form-control-label text-md-right">Detail</label> + <div class="col-md-10"> + <textarea class="form-control" [disabled]="restConfig.dynamic" rows="8" [ngModel]="detail" + (ngModelChange)="onDetailChanged($event)"></textarea> + </div> +</div> + diff --git a/sdc-workflow-designer-ui/src/app/components/menus/rest-config/rest-config-detail/rest-config-detail.component.ts b/sdc-workflow-designer-ui/src/app/components/menus/rest-config/rest-config-detail/rest-config-detail.component.ts new file mode 100644 index 00000000..d99a9a10 --- /dev/null +++ b/sdc-workflow-designer-ui/src/app/components/menus/rest-config/rest-config-detail/rest-config-detail.component.ts @@ -0,0 +1,83 @@ +/** + * 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, Input, OnChanges } from '@angular/core'; +import { ModalDirective } from 'ngx-bootstrap/modal'; + +import { Swagger } from '../../../../model/swagger'; +import { RestConfig } from '../../../../model/rest-config'; +import { RestService } from '../../../../services/rest.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: 'b4t-rest-config-detail', + templateUrl: 'rest-config-detail.component.html', +}) +export class RestConfigDetailComponent implements OnChanges { + @Input() restConfig: RestConfig; + + public detail: string; + + constructor(private restService: RestService) { + } + + public ngOnChanges() { + if (this.restConfig == null) { + this.restConfig = new RestConfig('', '', '', '', ''); + } + this.parseSwagger2String(); + } + + private parseSwagger2String() { + if (this.restConfig.swagger) { + this.detail = JSON.stringify(this.restConfig.swagger); + } else { + this.detail = ''; + } + } + + public onDetailChanged(detail: string) { + this.detail = detail; + + let swagger: Swagger = null; + try { + swagger = new Swagger(JSON.parse(detail)); + console.log(swagger); + } catch (e) { + console.log('detail transfer error'); + console.error(e); + } + this.restConfig.swagger = swagger; + } + + public toggleDynamic(dynamic: boolean) { + // this.restConfig.dynamic = dynamic; + + // if (this.restConfig.dynamic && this.restConfig.definition) { + // this.restService.getDynamicSwaggerInfo(this.restConfig.definition) + // .subscribe(response => { + // try { + // this.restConfig.swagger = new Swagger(response); + // this.parseSwagger2String(); + // } catch (e) { + // console.log('detail transfer error'); + // console.error(e); + // } + + // }); + // } + } + +} diff --git a/sdc-workflow-designer-ui/src/app/components/menus/microservice/microservice-list/microservice-list.component.css b/sdc-workflow-designer-ui/src/app/components/menus/rest-config/rest-config-list/rest-config-list.component.css index f403890e..f403890e 100644 --- a/sdc-workflow-designer-ui/src/app/components/menus/microservice/microservice-list/microservice-list.component.css +++ b/sdc-workflow-designer-ui/src/app/components/menus/rest-config/rest-config-list/rest-config-list.component.css diff --git a/sdc-workflow-designer-ui/src/app/components/menus/rest-config/rest-config-list/rest-config-list.component.html b/sdc-workflow-designer-ui/src/app/components/menus/rest-config/rest-config-list/rest-config-list.component.html new file mode 100644 index 00000000..aa98bc80 --- /dev/null +++ b/sdc-workflow-designer-ui/src/app/components/menus/rest-config/rest-config-list/rest-config-list.component.html @@ -0,0 +1,19 @@ +<div class="scroll" style="overflow:hidden; max-height: 300px; height: 300px;"> + <div class="card"> + <div class="card-header d-flex justify-content-between align-items-center"> + <span>Config List</span> + <span class="badge badge-success badge-pill" (click)="addRestConfig()"><i class="fa fa-plus"></i></span> + </div> + + <ul class="list-group"> + <li class="list-group-item d-flex justify-content-between align-items-center" + *ngFor="let restConfig of restService.getRestConfigs(); index as i"> + <div (click)="onConfigSelected(restConfig)">{{restConfig.name}}</div> + <div class="badge badge-danger badge-pill" (click)="deleteRestConfig(i)"> + <i class="fa fa-minus"></i> + </div> + </li> + </ul> + </div> +</div> + diff --git a/sdc-workflow-designer-ui/src/app/components/menus/rest-config/rest-config-list/rest-config-list.component.ts b/sdc-workflow-designer-ui/src/app/components/menus/rest-config/rest-config-list/rest-config-list.component.ts new file mode 100644 index 00000000..59c9c9af --- /dev/null +++ b/sdc-workflow-designer-ui/src/app/components/menus/rest-config/rest-config-list/rest-config-list.component.ts @@ -0,0 +1,57 @@ +/** + * 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, EventEmitter, Input, Output } from '@angular/core'; +import { ModalDirective } from 'ngx-bootstrap/modal'; + +import { Swagger } from '../../../../model/swagger'; +import { RestConfig } from '../../../../model/rest-config'; +import { RestService } from '../../../../services/rest.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: 'b4t-rest-config-list', + templateUrl: 'rest-config-list.component.html', +}) +export class RestConfigListComponent { + @Output() configSelected = new EventEmitter<RestConfig>(); + + constructor(public restService: RestService) { + } + + public onConfigSelected(restConfig: RestConfig) { + this.configSelected.emit(restConfig); + } + + public addRestConfig() { + const restConfig = this.restService.addRestConfig(); + + this.onConfigSelected(restConfig); + } + + public deleteRestConfig(index: number) { + // this.restService.getRestConfigs().splice(index, 1); + + // let restConfig; + // if (this.restService.getRestConfigs().length > 0) { + // if (this.restService.getRestConfigs()[index]) { + // restConfig = this.restService.getRestConfigs()[index]; + // } else { + // restConfig = this.restService.getRestConfigs()[index - 1]; + // } + // } + // this.onConfigSelected(restConfig); + } +} diff --git a/sdc-workflow-designer-ui/src/app/components/menus/rest-config/rest-config.component.html b/sdc-workflow-designer-ui/src/app/components/menus/rest-config/rest-config.component.html new file mode 100644 index 00000000..9bd5bfc0 --- /dev/null +++ b/sdc-workflow-designer-ui/src/app/components/menus/rest-config/rest-config.component.html @@ -0,0 +1,26 @@ +<div class="modal fade" bsModal #restConfigModal="bs-modal" [config]="{backdrop: 'static'}" + tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true"> + <div class="modal-dialog modal-lg"> + <div class="modal-content"> + <div class="modal-header"> + <h4 class="modal-title pull-left">Rest Config Setting</h4> + <button type="button" class="close pull-right" aria-label="Close" (click)="restConfigModal.hide()"> + <span aria-hidden="true">×</span> + </button> + </div> + <div class="modal-body"> + <div class="row"> + <div class="col-sm-4"> + <b4t-rest-config-list (configSelected)="configSelected($event)"></b4t-rest-config-list> + </div> + <div class="col-sm-8"> + <b4t-rest-config-detail [restConfig]="currentRestConfig"></b4t-rest-config-detail> + </div> + </div> + </div> + <div class="modal-footer"> + <button type="button" class="btn over-grey" (click)="restConfigModal.hide()">close</button> + </div> + </div> + </div> +</div> diff --git a/sdc-workflow-designer-ui/src/app/components/menus/rest-config/rest-config.component.ts b/sdc-workflow-designer-ui/src/app/components/menus/rest-config/rest-config.component.ts new file mode 100644 index 00000000..6a9c9c22 --- /dev/null +++ b/sdc-workflow-designer-ui/src/app/components/menus/rest-config/rest-config.component.ts @@ -0,0 +1,43 @@ +/** + * 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 { AfterViewInit, Component, ViewChild } from '@angular/core'; +import { ModalDirective } from 'ngx-bootstrap/modal'; + +import { RestService } from '../../../services/rest.service'; +import { RestConfigListComponent } from './rest-config-list/rest-config-list.component'; + +/** + * 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: 'b4t-rest-config', + templateUrl: 'rest-config.component.html', +}) +export class RestConfigComponent { + @ViewChild('restConfigModal') public restConfigModal: ModalDirective; + + public currentRestConfig: any = {}; + + constructor() { + } + + public configSelected(restConfig: any) { + this.currentRestConfig = restConfig; + } + + public show() { + this.restConfigModal.show(); + } + +} diff --git a/sdc-workflow-designer-ui/src/app/components/menus/workflows/workflows.component.ts b/sdc-workflow-designer-ui/src/app/components/menus/workflows/workflows.component.ts index c771b535..afacd602 100644 --- a/sdc-workflow-designer-ui/src/app/components/menus/workflows/workflows.component.ts +++ b/sdc-workflow-designer-ui/src/app/components/menus/workflows/workflows.component.ts @@ -27,7 +27,7 @@ import { PlanModel } from "../../../model/plan-model"; export class WorkflowsComponent {
@ViewChild('workflowsModal') public workflowsModal: ModalDirective;
- public workflows :Map<number, any>;
+ public workflows :Map<string, any>;
constructor(private workflowService: WorkflowService) {
}
@@ -44,7 +44,7 @@ export class WorkflowsComponent { this.workflowsModal.show();
}
- public deleteWorkflow(planId: number) {
+ public deleteWorkflow(planId: string) {
this.workflowService.deleteWorkflow(planId);
}
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 35dfbf1e..31782962 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, OnChanges, OnInit, Output, SimpleChange import { PlanTreeviewItem } from '../../model/plan-treeview-item';
import { ValueSource } from '../../model/value-source.enum';
import { Parameter } from '../../model/workflow/parameter';
+import { DataService } from '../../services/data/data.service';
/**
* this component contains in property component if the corresponding node has parameter properties
@@ -47,7 +48,7 @@ export class ParameterComponent implements OnChanges, OnInit { public showValueSource = true;
public planValue: any = {};
- constructor() { }
+ constructor(private dataService: DataService) { }
public ngOnChanges(changes: SimpleChanges): void {
// if (changes.canInsert && !changes.canInsert.isFirstChange()) {
@@ -63,6 +64,7 @@ export class ParameterComponent implements OnChanges, OnInit { if (1 === this.valueSource.length) {
this.showValueSource = false;
}
+ this.topologyOptions = this.dataService.getTopologyProperties();
// this.valueClass = {
// 'col-md-7': this.showValueSource,
// 'col-md-12': !this.showValueSource
diff --git a/sdc-workflow-designer-ui/src/app/components/property/start-event-parameters/start-event-parameters.component.html b/sdc-workflow-designer-ui/src/app/components/property/error-event/error-event.component.html index d6aaafd8..45abdd0f 100644 --- a/sdc-workflow-designer-ui/src/app/components/property/start-event-parameters/start-event-parameters.component.html +++ b/sdc-workflow-designer-ui/src/app/components/property/error-event/error-event.component.html @@ -12,14 +12,4 @@ *******************************************************************************/ --> -<div class="form-group row"> - <div class="col-md-10"></div> - <div class="col-md-2"> - <button (click)="create();" type="button" class="btn blue1 pull-right"> - <i class="fa fa-plus"></i> - </button> - </div> -</div> - -<b4t-parameter *ngFor="let param of node.parameters; let i = index;" [param]="param" [canEditName]="true" - [valueSource]="sources" [canDelete]="true" (delete)="delete(i)"></b4t-parameter>
\ No newline at end of file +<b4t-parameter [param]="node.parameter" [valueSource]="sources"></b4t-parameter>
\ No newline at end of file diff --git a/sdc-workflow-designer-ui/src/app/components/property/start-event-parameters/start-event-parameters.component.ts b/sdc-workflow-designer-ui/src/app/components/property/error-event/error-event.component.ts index 65838792..f8a63a15 100644 --- a/sdc-workflow-designer-ui/src/app/components/property/start-event-parameters/start-event-parameters.component.ts +++ b/sdc-workflow-designer-ui/src/app/components/property/error-event/error-event.component.ts @@ -9,27 +9,17 @@ * Contributors: * ZTE - initial API and implementation and/or initial documentation *******************************************************************************/ -import { Component, Input, ViewChild } from '@angular/core'; -import { Subscription } from 'rxjs/Subscription'; +import { Component, Input } from '@angular/core'; import { ValueSource } from '../../../model/value-source.enum'; import { Parameter } from '../../../model/workflow/parameter'; -import { StartEvent } from '../../../model/workflow/start-event'; -import { BroadcastService } from '../../../services/broadcast.service'; +import { ErrorEvent } from '../../../model/workflow/error-event'; @Component({ - selector: 'b4t-start-event-parameters', - templateUrl: 'start-event-parameters.component.html', + selector: 'b4t-error-event', + templateUrl: 'error-event.component.html', }) -export class StartEventParametersComponent { - @Input() public node: StartEvent; +export class ErrorEventComponent { + @Input() public node: ErrorEvent; public sources: ValueSource[] = [ValueSource.String]; - - public create(): void { - this.node.parameters.push(new Parameter('', '', ValueSource[ValueSource.String])); - } - - public delete(index: number): void { - this.node.parameters.splice(index, 1); - } } diff --git a/sdc-workflow-designer-ui/src/app/components/property/intermediate-catch-event/intermediate-catch-event.component.html b/sdc-workflow-designer-ui/src/app/components/property/intermediate-catch-event/intermediate-catch-event.component.html index f615d9f2..3395a6ee 100644 --- a/sdc-workflow-designer-ui/src/app/components/property/intermediate-catch-event/intermediate-catch-event.component.html +++ b/sdc-workflow-designer-ui/src/app/components/property/intermediate-catch-event/intermediate-catch-event.component.html @@ -13,7 +13,7 @@ --> <div class="form-group row"> - <label class="col-md-3 form-control-label text-md-right">Timer Type</label> + <label class="col-md-3 form-control-label text-md-right">{{'WORKFLOW.TIMER_TYPE' | translate}}</label> <div class="col-md-9"> <p-radioButton name="timeType" label="Duration" value="timeDuration" [ngModel]="node.timerEventDefinition.type" (ngModelChange)="timerTypeChange($event)">Duration</p-radioButton> <p-radioButton name="timeType" label="Date" value="timeDate" [(ngModel)]="node.timerEventDefinition.type">Date</p-radioButton> @@ -22,7 +22,7 @@ </div> <div *ngIf="node.timerEventDefinition.type === 'timeDuration'" class="form-group row"> - <label class="col-md-3 form-control-label text-md-right">Duration</label> + <label class="col-md-3 form-control-label text-md-right">{{'WORKFLOW.TIMER_DURATION' | translate}}</label> <div class="col-md-9"> <input type="text" class="form-control" [(ngModel)]="node.timerEventDefinition.timeDuration"> <label>eg: P1Y3M5DT6H7M30S</label> @@ -30,16 +30,20 @@ </div> <div *ngIf="node.timerEventDefinition.type === 'timeDate'" class="form-group row"> - <label class="col-md-3 form-control-label text-md-right">Date</label> + <label class="col-md-3 form-control-label text-md-right">{{'WORKFLOW.TIMER_DATE' | translate}}</label> <div class="col-md-9"> <input type="text" class="form-control" [(ngModel)]="node.timerEventDefinition.timeDate"> - <label>eg: 10/10/2099 00:00:03</label> + <label>eg: 2007-04-05T12:30-02:00</label> + <!-- + <p-calendar [(ngModel)]="node.timerEventDefinition.timeDate" [showIcon]="true" [showTime]="true" [showSeconds]="true"></p-calendar> + --> </div> </div> <div *ngIf="node.timerEventDefinition.type === 'timeCycle'" class="form-group row"> - <label class="col-md-3 form-control-label text-md-right">Cycle</label> + <label class="col-md-3 form-control-label text-md-right">{{'WORKFLOW.TIMER_CYCLE' | translate}}</label> <div class="col-md-9"> <input type="text" class="form-control" [(ngModel)]="node.timerEventDefinition.timeCycle"> + <label>eg: R5/P1Y2M10DT2H30M</label> </div> </div> diff --git a/sdc-workflow-designer-ui/src/app/components/property/node-template/node-template.component.html b/sdc-workflow-designer-ui/src/app/components/property/node-template/node-template.component.html new file mode 100644 index 00000000..5768c0b5 --- /dev/null +++ b/sdc-workflow-designer-ui/src/app/components/property/node-template/node-template.component.html @@ -0,0 +1,49 @@ +<!-- +/** + * 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 + */ +--> + +<div class="form-group row"> + <label class="col-md-3 form-control-label text-md-right">{{'WORKFLOW.TOSCA_NODE' | translate}}</label> + <div class="col-md-9"> + <select class="form-control" [ngModel]="node.template.id" + (ngModelChange)="node.template.id=$event; nodeTemplateChanged();"> + <option *ngFor="let template of nodeTemplates" value="{{template.id}}">{{template.name}}</option> + </select> + </div> +</div> + +<div class="form-group row"> + <label class="col-md-3 form-control-label text-md-right">{{'WORKFLOW.TOSCA_INTERFACE' | translate}}</label> + <div class="col-md-9"> + <select class="form-control" [ngModel]="node.nodeInterface" + (ngModelChange)="nodeInterfaceChanged($event);"> + <option *ngFor="let interface of nodeInterfaces" value="{{interface}}">{{interface}}</option> + </select> + </div> +</div> + +<div class="form-group row"> + <label class="col-md-3 form-control-label text-md-right">{{'WORKFLOW.TOSCA_OPERATION' | translate}}</label> + <div class="col-md-9"> + <select class="form-control" [ngModel]="node.operation" + (ngModelChange)="nodeOperationChanged($event)"> + <option *ngFor="let operation of nodeOperations" value="{{operation}}">{{operation}}</option> + </select> + </div> +</div> +<hr> + +<b4t-parameter *ngFor="let input of node.input" [param]="input" [valueSource]= "inputSources" [planItems]="planItems"></b4t-parameter> +<hr *ngIf="0 < node.input.length"> +<b4t-parameter *ngFor="let output of node.output" [param]="output" [valueSource]= "outputSources" [planItems]="planItems"></b4t-parameter> + diff --git a/sdc-workflow-designer-ui/src/app/components/property/node-template/node-template.component.ts b/sdc-workflow-designer-ui/src/app/components/property/node-template/node-template.component.ts new file mode 100644 index 00000000..5d7339d0 --- /dev/null +++ b/sdc-workflow-designer-ui/src/app/components/property/node-template/node-template.component.ts @@ -0,0 +1,132 @@ +/** + * 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 { AfterViewInit, Component, Input } from '@angular/core'; +import { Subscription } from '../../../../../node_modules/rxjs/Subscription.d'; + +import { PlanTreeviewItem } from '../../../model/plan-treeview-item'; +import { NodeTemplate } from '../../../model/topology/node-template'; +import { ValueSource } from '../../../model/value-source.enum'; +import { Parameter } from '../../../model/workflow/parameter'; +import { ToscaNodeTask } from '../../../model/workflow/tosca-node-task'; +import { BroadcastService } from '../../../services/broadcast.service'; +import { DataService } from '../../../services/data/data.service'; + +/** + * node template component provides operations about tosca modules which saved in winery. + * This component will be used in the property component while the corresponding workflow node is calling the node template's operation + */ +@Component({ + selector: 'b4t-node-template', + templateUrl: 'node-template.component.html', +}) +export class NodeTemplateComponent implements AfterViewInit { + @Input() public node: ToscaNodeTask; + @Input() public planItems: PlanTreeviewItem[]; + + public inputSources: ValueSource[] = [ValueSource.String, ValueSource.Variable, ValueSource.Topology, ValueSource.Plan]; + public outputSources: ValueSource[] = [ValueSource.Topology, ValueSource.Plan]; + public nodeInterfaces: string[] = []; + public nodeOperations: any[] = []; + public nodeTemplates: NodeTemplate[] = []; + + constructor(private dataService: DataService) { + } + + public ngAfterViewInit() { + this.dataService.loadNodeTemplates() + .subscribe(nodeTemplates => this.nodeTemplates = nodeTemplates); + + this.loadInterfaces(); + this.loadOperations(); + } + + public nodeTemplateChanged() { + this.setTemplateNamespace(); + + this.nodeInterfaceChanged(''); + + this.loadInterfaces(); + } + + public nodeInterfaceChanged(newInterface: string) { + this.node.nodeInterface = newInterface; + + this.nodeOperationChanged(''); + + this.loadOperations(); + } + + public nodeOperationChanged(operation: string) { + this.node.operation = operation; + + this.node.input = []; + this.node.output = []; + + this.loadParameters(); + } + + private setTemplateNamespace() { + const nodeTemplate = this.nodeTemplates.find( + tmpNodeTemplate => tmpNodeTemplate.id === this.node.template.id); + + if (nodeTemplate) { + this.node.template.namespace = nodeTemplate.namespace; + this.node.template.type = nodeTemplate.type; + } + } + + private loadInterfaces() { + if (this.node.template.id) { + this.dataService.loadNodeTemplateInterfaces(this.node.template) + .subscribe(interfaces => { + this.nodeInterfaces = interfaces; + }); + } else { + this.nodeInterfaces = []; + } + } + + private loadOperations() { + if (this.node.nodeInterface) { + this.nodeOperations = []; + this.dataService.loadNodeTemplateOperations( + this.node.template, + this.node.nodeInterface) + .subscribe(operations => this.nodeOperations = operations); + } else { + this.nodeOperations = []; + } + } + + private loadParameters() { + if (this.node.operation) { + this.dataService.loadNodeTemplateOperationParameter( + this.node.template, + this.node.nodeInterface, + this.node.operation) + .subscribe(params => { + this.node.input = []; + this.node.output = []; + + params.input.forEach(param => { + const p = new Parameter(param, '', ValueSource[ValueSource.String]); + this.node.input.push(p); + }); + + params.output.forEach(param => { + const p = new Parameter(param, '', ValueSource[ValueSource.Definition]); + this.node.output.push(p); + }); + }); + } + } +} diff --git a/sdc-workflow-designer-ui/src/app/components/property/properties.component.css b/sdc-workflow-designer-ui/src/app/components/property/properties.component.css index 4487e0b3..6c8c67d3 100644 --- a/sdc-workflow-designer-ui/src/app/components/property/properties.component.css +++ b/sdc-workflow-designer-ui/src/app/components/property/properties.component.css @@ -10,7 +10,7 @@ * ZTE - initial API and implementation and/or initial documentation */ - .wm-properties-wrapper { +.wm-properties-wrapper { background-color: white; position: fixed; width: 500px; 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 99f14b56..8aa912d7 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 @@ -12,7 +12,7 @@ */ --> - <div class="wm-properties-wrapper" *ngIf="show"> +<div class="wm-properties-wrapper" *ngIf="show"> <div class="form-group row"> <b4t-editable-property class="col-md-10" [(name)]="node.name"></b4t-editable-property> <div class="col-md-2"> @@ -34,6 +34,9 @@ <hr> <div [ngSwitch]="node.type"> <b4t-start-event *ngSwitchCase="nodeType[nodeType.startEvent]" [node]="node"></b4t-start-event> + <b4t-error-event *ngSwitchCase="nodeType[nodeType.errorStartEvent]" [node]="node"></b4t-error-event> + <b4t-error-event *ngSwitchCase="nodeType[nodeType.errorEndEvent]" [node]="node"></b4t-error-event> + <b4t-node-template *ngSwitchCase="nodeType[nodeType.toscaNodeManagementTask]" [node]="node" [planItems]="planTreeviewItems"></b4t-node-template> <b4t-rest-task *ngSwitchCase="nodeType[nodeType.restTask]" [node]="node" [planItems]="planTreeviewItems"></b4t-rest-task> <b4t-intermediate-catch-event *ngSwitchCase="nodeType[nodeType.intermediateCatchEvent]" [node]="node"></b4t-intermediate-catch-event> <b4t-script-task *ngSwitchCase="nodeType[nodeType.scriptTask]" [node]="node"></b4t-script-task> 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 c49b4661..56db6583 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 @@ -12,6 +12,7 @@ import { Component, OnInit } from '@angular/core'; import { TreeNode } from 'primeng/primeng'; +import { TranslateService } from '@ngx-translate/core'; import { PlanTreeviewItem } from '../../model/plan-treeview-item'; import { ValueSource } from '../../model/value-source.enum'; @@ -21,6 +22,7 @@ import { WorkflowNode } from '../../model/workflow/workflow-node'; import { BroadcastService } from '../../services/broadcast.service'; import { JsPlumbService } from '../../services/jsplumb.service'; import { ModelService } from '../../services/model.service'; +import { NoticeService } from '../../services/notice.service'; /** * property component presents information of a workflow node. @@ -43,6 +45,8 @@ export class PropertiesComponent implements OnInit { constructor(private broadcastService: BroadcastService, private modelService: ModelService, + private translate: TranslateService, + private noticeService: NoticeService, private jsPlumbService: JsPlumbService) { } @@ -59,7 +63,9 @@ export class PropertiesComponent implements OnInit { this.show = true; } catch (error) { this.show = false; - console.log(error); + this.translate.get('WORKFLOW.MSG.SWAGGER_NOT_EXISTS').subscribe((res: string) => { + this.noticeService.error(res); + }); } } else { this.show = false; 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 99b8a0f4..089d242d 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 @@ -13,7 +13,7 @@ --> <div class="form-group row"> - <label class="col-md-3 form-control-label text-md-right">Service</label> + <label class="col-md-3 form-control-label text-md-right">{{'WORKFLOW.REST_SERVICE' | translate}}</label> <div class="col-md-9"> <select class="form-control" [ngModel]="node.restConfigId" (ngModelChange)="serviceChanged($event)"> <option *ngFor="let restConfig of restService.getRestConfigs()" value="{{restConfig.id}}">{{restConfig.id}}</option> @@ -22,7 +22,7 @@ </div> <div class="form-group row"> - <label class="col-md-3 form-control-label text-md-right">Path</label> + <label class="col-md-3 form-control-label text-md-right">{{'WORKFLOW.REST_PATH' | translate}}</label> <div class="col-md-9"> <select class="form-control" [ngModel]="node.path" (ngModelChange)="pathChanged($event)"> <option *ngFor="let interface of restInterfaces" value="{{interface}}">{{interface}}</option> @@ -31,7 +31,7 @@ </div> <div class="form-group row"> - <label class="col-md-3 form-control-label text-md-right">Method</label> + <label class="col-md-3 form-control-label text-md-right">{{'WORKFLOW.REST_METHOD' | translate}}</label> <div class="col-md-9"> <select class="form-control" [ngModel]="node.method" (ngModelChange)="methodChanged($event)"> <option *ngFor="let operation of restOperations" value="{{operation}}">{{operation}}</option> 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 dfb2f0f3..0dccee1e 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 @@ -11,6 +11,7 @@ *******************************************************************************/ import { Component, Input, OnInit } from '@angular/core'; import { Subscription } from 'rxjs/Subscription'; +import { TranslateService } from '@ngx-translate/core'; import { PlanTreeviewItem } from '../../../model/plan-treeview-item'; import { Swagger, SwaggerMethod, SwaggerParameter, SwaggerResponse } from '../../../model/swagger'; @@ -19,6 +20,7 @@ import { ValueType } from '../../../model/value-type.enum'; import { RestParameter } from '../../../model/workflow/rest-parameter'; import { RestTask } from '../../../model/workflow/rest-task'; import { BroadcastService } from '../../../services/broadcast.service'; +import { NoticeService } from '../../../services/notice.service'; import { RestService } from '../../../services/rest.service'; import { WorkflowUtil } from '../../../util/workflow-util'; @@ -34,7 +36,8 @@ export class RestTaskComponent implements OnInit { public restOperations: any = []; private swagger: Swagger; - constructor(private broadcastService: BroadcastService, public restService: RestService) { } + constructor(private broadcastService: BroadcastService, public restService: RestService, + private noticeService: NoticeService, private translate: TranslateService) { } public ngOnInit() { this.loadInterfaces(); @@ -72,7 +75,9 @@ export class RestTaskComponent implements OnInit { } this.loadOperations(); } else { - console.log('swagger not exist'); + this.translate.get('WORKFLOW.MSG.SWAGGER_NOT_EXISTS').subscribe((res: string) => { + this.noticeService.error(res); + }); } } } 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 6d2bf1ac..53e253e2 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 @@ -13,14 +13,16 @@ -->
<div class="form-group row">
- <label class="col-md-3 form-control-label text-md-right">Script Format</label>
+ <label class="col-md-3 form-control-label text-md-right">{{'WORKFLOW.SCRIPT_FORMAT' | translate}}</label>
<div class="col-md-9">
- <input class="form-control" type="text" [(ngModel)]="node.scriptFormate">
+ <select class="form-control" [(ngModel)]="node.scriptFormat">
+ <option *ngFor="let script of scriptOperations" value="{{script}}">{{script}}</option>
+ </select>
</div>
</div>
<div class="form-group row">
- <label class="col-md-3 form-control-label text-md-right">Script</label>
+ <label class="col-md-3 form-control-label text-md-right">{{'WORKFLOW.SCRIPT' | translate}}</label>
<div class="col-md-9">
<textarea class="form-control" type="text" rows="20" [(ngModel)]="node.script"></textarea>
</div>
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 9e55ed49..1dd3b7a6 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 @@ -19,4 +19,6 @@ import { ScriptTask } from "../../../model/workflow/script-task"; })
export class ScriptTaskComponent {
@Input() public node: ScriptTask;
+
+ public scriptOperations = ['JavaScript'];
}
diff --git a/sdc-workflow-designer-ui/src/app/components/toolbar/toolbar.component.ts b/sdc-workflow-designer-ui/src/app/components/toolbar/toolbar.component.ts index c204a19b..dcb93120 100644 --- a/sdc-workflow-designer-ui/src/app/components/toolbar/toolbar.component.ts +++ b/sdc-workflow-designer-ui/src/app/components/toolbar/toolbar.component.ts @@ -12,6 +12,7 @@ import { AfterViewChecked, Component, OnInit } from '@angular/core';
+import { DataService } from '../../services/data/data.service';
import { BroadcastService } from '../../services/broadcast.service';
import { JsPlumbService } from '../../services/jsplumb.service';
@@ -26,11 +27,16 @@ import { JsPlumbService } from '../../services/jsplumb.service'; })
export class ToolbarComponent implements AfterViewChecked, OnInit {
public isCatalog = true;
- private needInitButton = true;
+ private needInitButton = false;
- constructor(private jsPlumbService: JsPlumbService, private broadcastService: BroadcastService) { }
+ constructor(private jsPlumbService: JsPlumbService, private broadcastService: BroadcastService,
+ private dataService: DataService) { }
public ngOnInit() {
+ this.broadcastService.backendServiceReady$.subscribe(() => {
+ this.isCatalog = 'Catalog' === this.dataService.getBackendType();
+ this.needInitButton = true;
+ });
}
public ngAfterViewChecked() {
|