From c21ba95e56f70ba9fbe0daa3ac4b413424b323eb Mon Sep 17 00:00:00 2001 From: Arielk Date: Sun, 21 Apr 2019 16:07:44 +0300 Subject: bug fixes to operation screen and External workflowartifact completion Change-Id: I9d71385d6e29e1736a24f9d84581e465187e9f26 Issue-ID: SDC-2249 Signed-off-by: Arielk --- .../interface-operation.page.component.html | 21 ++++-- .../interface-operation.page.component.ts | 48 +++++++++----- .../operation-creator.component.html | 35 +++++++++- .../operation-creator.component.less | 19 ++++++ .../operation-creator.component.ts | 56 ++++++++++++---- .../param-row/param-row.component.html | 4 +- .../param-row/param-row.component.ts | 75 ++++++++++++++++------ 7 files changed, 202 insertions(+), 56 deletions(-) (limited to 'catalog-ui/src/app/ng2/pages/interface-operation') diff --git a/catalog-ui/src/app/ng2/pages/interface-operation/interface-operation.page.component.html b/catalog-ui/src/app/ng2/pages/interface-operation/interface-operation.page.component.html index afeff48d91..e32a0b60f5 100644 --- a/catalog-ui/src/app/ng2/pages/interface-operation/interface-operation.page.component.html +++ b/catalog-ui/src/app/ng2/pages/interface-operation/interface-operation.page.component.html @@ -21,7 +21,7 @@ class="top-add-btn add-btn" *ngIf="!isListEmpty()" [ngClass]="{'disabled': readonly}" - data-tests-id="addInterfaceOperation" + data-tests-id="add-operation" (click)="onEditOperation()"> {{ 'INTERFACE_ADD_OPERATION' | translate }} @@ -33,6 +33,7 @@ *ngIf="isListEmpty() && !isLoading">
{{ 'INTERFACE_EXPAND_ALL' | translate }} | {{ 'INTERFACE_COLLAPSE_ALL' | translate }} @@ -64,10 +67,12 @@
+ *ngFor="let interface of interfaces" + [attr.data-tests-id]="'interface-' + interface.displayType()">
+ class="cell field-name" + [attr.data-tests-id]="'operation-' + operation.name + '-name'"> {{operation.name}} + [ngClass]="{'collapsed': operation.isCollapsed}" + [attr.data-tests-id]="'operation-' + operation.name + '-description'"> {{operation.getDescriptionEllipsis()}} + (click)="operation.toggleCollapsed($event)" + [attr.data-tests-id]="'operation-' + operation.name + '-ellipsis'"> {{!operation.isEllipsis ? '' : operation.isCollapsed ? 'More' : 'Less'}} ) => { - this.isLoading = false; - this.initInterfaces(response[0].interfaces); - this.sortInterfaces(); - this.inputs = response[1].inputs; - this.interfaceTypes = response[2]; - this.workflows = response[3]; + const callback = (workflows) => { + this.isLoading = false; + this.initInterfaces(response[0].interfaces); + this.sortInterfaces(); + this.inputs = response[1].inputs; + this.interfaceTypes = response[2]; + this.workflows = workflows; + }; + if (this.enableWorkflowAssociation && this.workflowIsOnline) { + this.WorkflowServiceNg2.getWorkflows().subscribe( + callback, + (err) => { + this.workflowIsOnline = false; + callback([]); + } + ); + } else { + callback([]); + } }); } @@ -306,7 +318,7 @@ export class InterfaceOperationComponent { let curInterf = _.find( this.interfaces, interf => interf.type === operation.interfaceType - ) + ); if (!curInterf) { curInterf = new UIInterfaceModel({ type: response.interfaceType, @@ -318,7 +330,9 @@ export class InterfaceOperationComponent { curInterf.operations.push(new UIOperationModel(response)); this.sortInterfaces(); - if (response.workflowId && operation.workflowAssociationType === WORKFLOW_ASSOCIATION_OPTIONS.EXISTING) { + if (operation.workflowAssociationType === WORKFLOW_ASSOCIATION_OPTIONS.EXTERNAL) { + this.ComponentServiceNg2.uploadInterfaceOperationArtifact(this.component, response, operation).subscribe(); + } else if (response.workflowId && operation.workflowAssociationType === WORKFLOW_ASSOCIATION_OPTIONS.EXISTING) { this.WorkflowServiceNg2.associateWorkflowArtifact(this.component, response).subscribe(); } else if (operation.workflowAssociationType === WORKFLOW_ASSOCIATION_OPTIONS.NEW) { this.$state.go('workspace.plugins', { path: 'workflowDesigner' }); @@ -330,20 +344,24 @@ export class InterfaceOperationComponent { this.ComponentServiceNg2.updateInterfaceOperation(this.component, operation).subscribe(newOperation => { this.openOperation = null; + let oldOpIndex, oldInterf; _.forEach(this.interfaces, interf => { _.forEach(interf.operations, op => { if (op.uniqueId === newOperation.uniqueId) { - const oldIndex = _.findIndex(interf.operations, el => el.uniqueId === op.uniqueId); - interf.operations.splice(oldIndex, 1); + oldInterf = interf; + oldOpIndex = _.findIndex(interf.operations, el => el.uniqueId === op.uniqueId); } }) }); + oldInterf.operations.splice(oldOpIndex, 1); const newInterf = _.find(this.interfaces, interf => interf.type === operation.interfaceType); newInterf.operations.push(new UIOperationModel(newOperation)); this.sortInterfaces(); - if (newOperation.workflowId && operation.workflowAssociationType === WORKFLOW_ASSOCIATION_OPTIONS.EXISTING) { + if (operation.workflowAssociationType === WORKFLOW_ASSOCIATION_OPTIONS.EXTERNAL) { + this.ComponentServiceNg2.uploadInterfaceOperationArtifact(this.component, newOperation, operation).subscribe(); + } else if (newOperation.workflowId && operation.workflowAssociationType === WORKFLOW_ASSOCIATION_OPTIONS.EXISTING) { this.WorkflowServiceNg2.associateWorkflowArtifact(this.component, newOperation).subscribe(); } }); diff --git a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.html b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.html index 9f78088609..5faddd829c 100644 --- a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.html +++ b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.html @@ -50,7 +50,8 @@ label="{{ 'OPERATION_NAME' | translate }}" [(value)]="operation.name" testId="operationName" - (valueChange)="onChangeName()"> + (valueChange)="onChangeName()" + [disabled]="readonly">
@@ -80,7 +81,37 @@
-
+
+ +
+ +
+ + {{ operation.artifactFile && operation.artifactFile.name }} + +
+ +
+