X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=catalog-ui%2Fsrc%2Fapp%2Fng2%2Fpages%2Fproperties-assignment%2Ftosca-function%2Ftosca-function.component.ts;h=412e29a427c90db65fa709da68cabc5015871f81;hb=d32437595314c9b5b2aa439a482d0b07286a8072;hp=29290805afa5d12140fb884a1ab7ead0c2cb8ade;hpb=0977894d34b43eba0846b23dd5bc4f186ca7edc2;p=sdc.git diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.ts index 29290805af..412e29a427 100644 --- a/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.ts +++ b/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.ts @@ -52,6 +52,7 @@ export class ToscaFunctionComponent implements OnInit, OnChanges { @Input() allowClear: boolean = true; @Input() compositionMap: boolean = false; @Input() compositionMapKey: string = ""; + @Input() complexListKey: string = null; @Output() onValidFunction: EventEmitter = new EventEmitter(); @Output() onValidityChange: EventEmitter = new EventEmitter(); @@ -108,7 +109,15 @@ export class ToscaFunctionComponent implements OnInit, OnChanges { private initToscaFunction(): void { if (this.compositionMap && this.property.subPropertyToscaFunctions) { let keyToFind = [this.compositionMapKey]; - let subPropertyToscaFunction = this.property.subPropertyToscaFunctions.find(subPropertyToscaFunction => this.areEqual(subPropertyToscaFunction.subPropertyPath, keyToFind)); + if (this.complexListKey != null) { + keyToFind = [this.complexListKey,this.compositionMapKey]; + } + let subPropertyToscaFunction; + this.property.subPropertyToscaFunctions.forEach(subToscaFunction => { + if (subToscaFunction.subPropertyPath.toString() == keyToFind.toString()) { + subPropertyToscaFunction = subToscaFunction; + } + }); if (subPropertyToscaFunction){ this.toscaFunction = subPropertyToscaFunction.toscaFunction; @@ -158,9 +167,9 @@ export class ToscaFunctionComponent implements OnInit, OnChanges { } this.toscaFunctionForm.setValue(this.inToscaFunction ? this.inToscaFunction : this.property.toscaFunction); - let type = this.property.toscaFunction.type; + let type = this.property.toscaFunction.type ? this.property.toscaFunction.type : this.toscaFunctionForm.value.type; if (type == ToscaFunctionType.CUSTOM) { - let name = (this.property.toscaFunction as ToscaCustomFunction).name; + let name = (this.toscaFunctionForm.value as ToscaCustomFunction).name; let customToscaFunc = this.customToscaFunctions.find(custToscFunc => _.isEqual(custToscFunc.name, name)) if (customToscaFunc) { this.toscaFunctionTypeForm.setValue(name); @@ -272,6 +281,7 @@ export class ToscaFunctionComponent implements OnInit, OnChanges { } else { this.toscaFunctionForm.setValue(undefined); } + this.emitValidityChange(); } onCustomFunctionValidityChange(validationEvent: ToscaCustomFunctionValidationEvent): void { @@ -298,6 +308,7 @@ export class ToscaFunctionComponent implements OnInit, OnChanges { } else { this.toscaFunctionForm.setValue(undefined); } + this.emitValidityChange(); } onFunctionTypeChange(): void {