Fix add property to a VFC 13/120613/2
authoraribeiro <anderson.ribeiro@est.tech>
Wed, 14 Apr 2021 14:43:59 +0000 (15:43 +0100)
committerChristophe Closset <christophe.closset@intl.att.com>
Mon, 19 Apr 2021 12:54:21 +0000 (12:54 +0000)
Added properties to a VFC were not being displayed on the UI

Issue-ID: SDC-3559
Signed-off-by: aribeiro <anderson.ribeiro@est.tech>
Change-Id: Iede582ada4a25ddfb8f5ca5936c71e5c2b25e50b

catalog-ui/src/app/ng2/services/component-services/topology-template.service.ts
catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view-model.ts
catalog-ui/src/app/view-models/workspace/tabs/properties/properties.less

index 9921499..7b726e4 100644 (file)
@@ -374,8 +374,9 @@ export class TopologyTemplateService {
 
     // ------------------------------------------------ Properties API --------------------------------------------------//
     addProperty = (componentType: string, componentId: string, property: PropertyModel):Observable<PropertyModel> => {
-        return this.http.post<PropertyModel>(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/properties', property.convertToServerObject()).map((response) => {
-            return new PropertyModel(response[Object.keys(response)[0]]);
+        return this.http.post<PropertyModel>(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/properties', property.convertToServerObject())
+        .map((response) => {
+            return new PropertyModel(response);
         });
     }
 
index 609997c..c63dd8a 100644 (file)
@@ -260,7 +260,6 @@ export class PropertyFormViewModel {
             };
 
             let onPropertySuccess = (propertyFromBE:PropertyModel):void => {
-                console.info('onPropertyResourceSuccess : ', propertyFromBE);
                 this.$scope.isLoading = false;
                 this.filteredProperties[this.$scope.currentPropertyIndex] = propertyFromBE;
                 if (!doNotCloseModal) {
@@ -410,19 +409,18 @@ export class PropertyFormViewModel {
             });
     };
 
-    private addOrUpdateProperty = (property:PropertyModel):Observable<PropertyModel> => {
+    private addOrUpdateProperty = (property: PropertyModel): Observable<PropertyModel> => {
         if (!property.uniqueId) {
-            let onSuccess = (property:PropertyModel):PropertyModel => {
-                let newProperty = new PropertyModel(property);
+            let onSuccess = (newProperty: PropertyModel): PropertyModel => {
                 this.filteredProperties.push(newProperty);
                 return newProperty;
             };
-            return this.topologyTemplateService.addProperty(this.workspaceService.metadata.componentType, this.workspaceService.metadata.uniqueId, property).map(onSuccess);
-        }
-        else {
-            let onSuccess = (newProperty:PropertyModel):PropertyModel => {
+            return this.topologyTemplateService.addProperty(this.workspaceService.metadata.componentType, this.workspaceService.metadata.uniqueId, property)
+            .map(onSuccess);
+        else {
+            let onSuccess = (newProperty: PropertyModel): PropertyModel => {
                 // find exist instance property in parent component for update the new value ( find bu uniqueId )
-                let existProperty:PropertyModel = <PropertyModel>_.find(this.filteredProperties, {uniqueId: newProperty.uniqueId});
+                let existProperty: PropertyModel = <PropertyModel>_.find(this.filteredProperties, {uniqueId: newProperty.uniqueId});
                 let propertyIndex = this.filteredProperties.indexOf(existProperty);
                 this.filteredProperties[propertyIndex] = newProperty;
                 return newProperty;
index 48c462e..0797126 100644 (file)
@@ -60,7 +60,8 @@
     }
 
     .table{
-        height:490px;
+        height: 100%;
+        min-height: 500px;
         margin-bottom: 0;
     }