Revert "Provide tosca function capability to complex type fields in composition view"
[sdc.git] / catalog-ui / src / app / ng2 / pages / properties-assignment / tosca-function / tosca-function.component.ts
index 792d9cb..34ed9a6 100644 (file)
@@ -82,6 +82,7 @@ export class ToscaFunctionComponent implements OnInit, OnChanges {
             if (!this.isInitialized) {
                 return;
             }
+            this.emitValidityChange();
             if (this.formGroup.valid) {
                 this.onValidFunction.emit(this.toscaFunctionForm.value);
             }
@@ -110,12 +111,12 @@ export class ToscaFunctionComponent implements OnInit, OnChanges {
             let keyToFind = [this.compositionMapKey];
             let subPropertyToscaFunction = this.property.subPropertyToscaFunctions.find(subPropertyToscaFunction => this.areEqual(subPropertyToscaFunction.subPropertyPath, keyToFind));
 
-            if (subPropertyToscaFunction){
-                this.toscaFunction = subPropertyToscaFunction.toscaFunction;
-                this.toscaFunctionForm.setValue(this.toscaFunction);
-                this.toscaFunctionTypeForm.setValue(this.toscaFunction.type);
-            }
-            return;
+                if (subPropertyToscaFunction){
+                       this.toscaFunction = subPropertyToscaFunction.toscaFunction;
+                    this.toscaFunctionForm.setValue(this.toscaFunction);
+                    this.toscaFunctionTypeForm.setValue(this.toscaFunction.type);
+                }
+                return;
         }
            if (this.property instanceof PropertyDeclareAPIModel && this.property.subPropertyToscaFunctions && (<PropertyDeclareAPIModel> this.property).propertiesName){
                let propertiesPath = (<PropertyDeclareAPIModel> this.property).propertiesName.split("#");
@@ -266,7 +267,6 @@ export class ToscaFunctionComponent implements OnInit, OnChanges {
         } else {
             this.toscaFunctionForm.setValue(undefined);
         }
-        this.emitValidityChange();
     }
 
     onYamlFunctionValidityChange(validationEvent: YamlFunctionValidationEvent): void {