diff options
author | MichaelMorris <michael.morris@est.tech> | 2022-03-07 12:44:23 +0000 |
---|---|---|
committer | Andr� Schmid <andre.schmid@est.tech> | 2022-03-08 10:35:28 +0000 |
commit | a8dc9814f491649e59bcfa17039615cd71477db1 (patch) | |
tree | c71d43b2f6ec53b7c9b52a116fb0162f89ad8a29 /catalog-ui/src/app/ng2 | |
parent | b96fc12cbd4d383df128de7504c9e167a122ab1b (diff) |
Support property of type List<Map<String,String>>
Signed-off-by: MichaelMorris <michael.morris@est.tech>
Issue-ID: SDC-3898
Change-Id: Ifc9ea422e0eafcf84b5b7e47a9108f62925e2ea0
Diffstat (limited to 'catalog-ui/src/app/ng2')
2 files changed, 11 insertions, 3 deletions
diff --git a/catalog-ui/src/app/ng2/components/logic/properties-table/dynamic-property/dynamic-property.component.html b/catalog-ui/src/app/ng2/components/logic/properties-table/dynamic-property/dynamic-property.component.html index 78c3030842..81f0d533b4 100644 --- a/catalog-ui/src/app/ng2/components/logic/properties-table/dynamic-property/dynamic-property.component.html +++ b/catalog-ui/src/app/ng2/components/logic/properties-table/dynamic-property/dynamic-property.component.html @@ -27,7 +27,7 @@ <div class="table-cell" *ngIf="!canBeDeclared && !property.isChildOfListOrMap"> <div class="inner-cell-div" tooltip="{{property.name}}"><span>{{property.name}}</span></div> </div> <!-- simple children of complex type within map or list --> - <div class="table-cell map-entry" *ngIf="property.isChildOfListOrMap && propType == derivedPropertyTypes.MAP"><!-- map left cell --> + <div class="table-cell map-entry" *ngIf="property.isChildOfListOrMap && propType == derivedPropertyTypes.MAP && !property.mapInlist"><!-- map left cell --> <dynamic-element #mapKeyInput class="value-input" pattern="validationUtils.getValidationPattern(string)" @@ -66,7 +66,8 @@ </ng-container> <!-- ICONS: add, delete, and expand --> <ng-container *ngIf="!property.isDeclared && !property.isToscaGetFunction()"> - <a *ngIf="(propType == derivedPropertyTypes.LIST || propType == derivedPropertyTypes.MAP) && !property.isChildOfListOrMap" class="property-icon add-item" (click)="createNewChildProperty();" [ngClass]="{'disabled':readonly || preventInsertItem(property)}" [attr.data-tests-id]="'add-to-list-' + propertyTestsId">Add value to list</a> + <a *ngIf="(propType == derivedPropertyTypes.LIST) && (!property.isChildOfListOrMap || property.mapInlist)" class="property-icon add-item" (click)="createNewChildProperty();" [ngClass]="{'disabled':readonly || preventInsertItem(property)}" [attr.data-tests-id]="'add-to-list-' + propertyTestsId">Add value to list</a> + <a *ngIf="(propType == derivedPropertyTypes.MAP) && (!property.isChildOfListOrMap || property.mapInlist)" class="property-icon add-item" (click)="createNewChildProperty();" [ngClass]="{'disabled':readonly || preventInsertItem(property)}" [attr.data-tests-id]="'add-to-list-' + propertyTestsId">Add value to map</a> <span *ngIf="property.isChildOfListOrMap" (click)="deleteItem.emit(property);" class="property-icon sprite-new delete-item-icon" [ngClass]="{'disabled':readonly}" [attr.data-tests-id]="'delete-from-list-' + propertyTestsId"></span> <span *ngIf="!isPropertyFEModel && (propType == derivedPropertyTypes.COMPLEX || ((propType == derivedPropertyTypes.LIST || propType == derivedPropertyTypes.MAP) && hasChildren))" (click)="expandChildById(propPath)" class="property-icon sprite-new round-expand-icon" [class.open]="expandedChildId.indexOf(propPath) == 0" [attr.data-tests-id]="'expand-' + propertyTestsId" ></span> </ng-container> diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/services/properties.utils.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/services/properties.utils.ts index 34d2a53afd..02dbf91868 100644 --- a/catalog-ui/src/app/ng2/pages/properties-assignment/services/properties.utils.ts +++ b/catalog-ui/src/app/ng2/pages/properties-assignment/services/properties.utils.ts @@ -129,7 +129,14 @@ export class PropertiesUtils { if (property.derivedDataType == DerivedPropertyType.LIST || property.derivedDataType == DerivedPropertyType.MAP) { property.flattenedChildren = []; Object.keys(property.valueObj).forEach((key) => { - property.flattenedChildren.push(...this.createListOrMapChildren(property, key, property.valueObj[key])) + property.flattenedChildren.push(...this.createListOrMapChildren(property, key, property.valueObj[key])); + const lastCreatedChild = property.flattenedChildren.slice(-1)[0]; + if (property.schemaType == PROPERTY_TYPES.MAP && property.valueObj[key]){ + const nestedValue:object = property.valueObj[key]; + Object.keys(nestedValue).forEach((keyNested) => { + property.flattenedChildren.push(...this.createListOrMapChildren(lastCreatedChild, keyNested, nestedValue[keyNested])); + }); + }; }); } else if (property.derivedDataType === DerivedPropertyType.COMPLEX) { property.flattenedChildren = this.createFlattenedChildren(property.type, property.name); |