From a1f5f7ae10ca3d433c5f66cd2f63ee2f0d1c6f92 Mon Sep 17 00:00:00 2001 From: Arielk Date: Thu, 8 Nov 2018 12:42:52 +0200 Subject: Fix validation bug in operation modal Checks is for only current tab parameters validity Change-Id: Ifd33a31c56fc3addd0ecf1479fb9d0559866b56c Issue-ID: SDC-1907 Signed-off-by: Arielk --- .../operation-creator.component.html | 2 +- .../operation-creator.component.ts | 27 ++++++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) (limited to 'catalog-ui/src') 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 6d5fd8d72f..982cbb204c 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 @@ -90,7 +90,7 @@ class="add-param-link add-btn" *ngIf="!isUsingExistingWF() && !readonly" data-tests-id="addInputParameter" - [ngClass]="{'disabled':!isParamsValid()}" + [ngClass]="{'disabled':!canAdd()}" (click)="addParam()">Add Parameter diff --git a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.ts b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.ts index 62473bd868..5d3b027493 100644 --- a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.ts +++ b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.ts @@ -246,10 +246,33 @@ export class OperationCreatorComponent { this.tableParameters.push(new OperationParameter(param)); } + canAdd(): boolean { + let valid = true; + if (this.currentTab === this.TYPE_INPUT) { + _.forEach(this.inputParameters, param => { + if (!param.name || !param.property) { + valid = false; + } + }); + } else { + _.forEach(this.outputParameters, param => { + if (!param.name || !param.type) { + valid = false; + } + }); + } + return valid; + } + isParamsValid(): boolean { let valid = true; - _.forEach(this.tableParameters, param => { - if (!param.name || (this.currentTab == this.TYPE_INPUT && !param.property)) { + _.forEach(this.inputParameters, param => { + if (!param.name || !param.property) { + valid = false; + } + }); + _.forEach(this.outputParameters, param => { + if (!param.name || !param.type) { valid = false; } }); -- cgit 1.2.3-korg