summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/models/properties-inputs
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-ui/src/app/models/properties-inputs')
-rw-r--r--catalog-ui/src/app/models/properties-inputs/derived-fe-property.ts19
-rw-r--r--catalog-ui/src/app/models/properties-inputs/property-fe-model.ts5
2 files changed, 20 insertions, 4 deletions
diff --git a/catalog-ui/src/app/models/properties-inputs/derived-fe-property.ts b/catalog-ui/src/app/models/properties-inputs/derived-fe-property.ts
index ac05f19b7b..2d406e210b 100644
--- a/catalog-ui/src/app/models/properties-inputs/derived-fe-property.ts
+++ b/catalog-ui/src/app/models/properties-inputs/derived-fe-property.ts
@@ -41,6 +41,7 @@ export class DerivedFEProperty extends PropertyBEModel {
canBeDeclared: boolean;
mapKey: string;
mapKeyError: string;
+ mapInlist: boolean
constructor(property: PropertyBEModel, parentName?: string, createChildOfListOrMap?: boolean, key?:string, value?:any) {
if (!createChildOfListOrMap) { //creating a standard derived prop
@@ -60,6 +61,11 @@ export class DerivedFEProperty extends PropertyBEModel {
this.mapKey = property.schema.property.type.split('.').pop();
this.mapKeyError = null;
this.type = property.schema.property.type;
+ if (this.type == PROPERTY_TYPES.MAP){
+ this.mapInlist = true;
+ }
+
+ this.schema = new SchemaPropertyGroupModel(new SchemaProperty(property.schema.property));
} else { //map
if (key) {
this.mapKey = key;
@@ -69,9 +75,19 @@ export class DerivedFEProperty extends PropertyBEModel {
this.mapKeyError = 'Key cannot be empty.';
}
this.type = property.type;
+ if (property.schema.property.type == PROPERTY_TYPES.MAP){
+ const schProp = new SchemaProperty();
+ schProp.isSimpleType = true;
+ schProp.isDataType = false;
+ schProp.simpleType = PROPERTY_TYPES.STRING;
+ this.schema = new SchemaPropertyGroupModel(schProp);
+ this.schemaType = PROPERTY_TYPES.STRING;
+ } else {
+ this.schema = new SchemaPropertyGroupModel(new SchemaProperty(property.schema.property));
+ }
+
}
this.valueObj = (this.type == PROPERTY_TYPES.JSON && typeof value == 'object') ? JSON.stringify(value) : value;
- this.schema = new SchemaPropertyGroupModel(new SchemaProperty(property.schema.property));
this.updateValueObjOrig();
}
// this.constraints = property ? property.constraints : null;
@@ -97,6 +113,7 @@ export class DerivedFEProperty extends PropertyBEModel {
public hasValueObjChanged() {
return !_.isEqual(this.valueObj, this.valueObjOrig);
}
+
}
export class DerivedFEPropertyMap {
[parentPath: string]: Array<DerivedFEProperty>;
diff --git a/catalog-ui/src/app/models/properties-inputs/property-fe-model.ts b/catalog-ui/src/app/models/properties-inputs/property-fe-model.ts
index 3b8c2d1351..d4b45408ca 100644
--- a/catalog-ui/src/app/models/properties-inputs/property-fe-model.ts
+++ b/catalog-ui/src/app/models/properties-inputs/property-fe-model.ts
@@ -157,7 +157,7 @@ export class PropertyFEModel extends PropertyBEModel {
_.set(this.valueObj, childPropName, null);
}
} else {
- _.set(this.valueObj, childPropName, childProp.valueObj);
+ _.set(this.valueObj, childPropName, childProp.valueObj);
}
if (childProp.valueObjIsChanged) {
_.set(this.valueObjValidation, childPropName, childProp.valueObjIsValid);
@@ -175,7 +175,6 @@ export class PropertyFEModel extends PropertyBEModel {
if (!childProp.isChildOfListOrMap || childProp.derivedDataType !== DerivedPropertyType.MAP) {
return;
}
-
const childParentNames = this.getParentNamesArray(childProp.parentName);
const oldActualMapKey = childProp.getActualMapKey();
@@ -240,7 +239,7 @@ export class PropertyFEModel extends PropertyBEModel {
let nameToInsert: string = parentProp.name;
if (parentProp.isChildOfListOrMap) {
- if (!noHashKeys && parentProp.derivedDataType == DerivedPropertyType.MAP) {
+ if (!noHashKeys && parentProp.derivedDataType == DerivedPropertyType.MAP && !parentProp.mapInlist) {
nameToInsert = parentProp.getActualMapKey();
} else { //LIST
let siblingProps = this.flattenedChildren.filter(prop => prop.parentName == parentProp.parentName).map(prop => prop.propertiesName);