UI support for metadata when editing properties of VFCs
[sdc.git] / catalog-ui / src / app / view-models / forms / property-forms / component-property-form / property-form-view-model.ts
index 0be5193..faf2a0f 100644 (file)
@@ -537,6 +537,19 @@ export class PropertyFormViewModel {
             this.$scope.editPropertyModel.property.constraints = constraints.constraints;
         }
 
+        this.$scope.onPropertyMetadataChange = (metadata: any): void => {
+            if (!this.$scope.invalidMandatoryFields) {
+                this.$scope.footerButtons[0].disabled = !metadata.valid;
+            } else {
+                this.$scope.footerButtons[0].disabled = this.$scope.invalidMandatoryFields;
+            }
+            if (!metadata.metadata || metadata.metadata.length == 0) {
+                this.$scope.editPropertyModel.property.metadata = null;
+                return;
+            }
+            this.$scope.editPropertyModel.property.metadata = metadata.metadata;
+        }
+
         this.$scope.onGetFunctionValidFunction = (toscaGetFunction: ToscaGetFunction): void => {
             this.$scope.editPropertyModel.property.toscaFunction = toscaGetFunction;
         }