diff options
author | Arielk <Ariel.Kenan@amdocs.com> | 2018-11-08 12:42:52 +0200 |
---|---|---|
committer | Avi Gaffa <avi.gaffa@amdocs.com> | 2018-11-08 13:30:38 +0000 |
commit | a1f5f7ae10ca3d433c5f66cd2f63ee2f0d1c6f92 (patch) | |
tree | f7594efa4ebb30e2f1965fa8c6c1fddf3e1d77f4 | |
parent | 18818479e05a9470bdeeca8029e3717b634da04e (diff) |
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 <Ariel.Kenan@amdocs.com>
2 files changed, 26 insertions, 3 deletions
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</a> </div> 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; } }); |