diff options
author | Tal Gitelman <tg851x@intl.att.com> | 2017-07-03 20:16:55 +0300 |
---|---|---|
committer | Tal Gitelman <tg851x@intl.att.com> | 2017-07-03 20:16:55 +0300 |
commit | 153a35821f0d25ce23cca467b76c5a7c5092c744 (patch) | |
tree | 0c66c4d1310019479e446ea3a4c26faffb0aa33f /catalog-ui/src/app/models/properties-inputs/property-fe-model.ts | |
parent | ffdda7d685029d6a88ac82ac637e43bba96423cb (diff) |
[sdc] - last merges before moving to LF
Change-Id: I0df3ec795f0de84229ea4bb4806ec8f959243557
Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
Diffstat (limited to 'catalog-ui/src/app/models/properties-inputs/property-fe-model.ts')
-rw-r--r-- | catalog-ui/src/app/models/properties-inputs/property-fe-model.ts | 9 |
1 files changed, 6 insertions, 3 deletions
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 cfbe6d64c7..bfb6462f63 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 @@ -6,11 +6,12 @@ import { FilterPropertiesAssignmentData, PropertyBEModel, DerivedPropertyType, D export class PropertyFEModel extends PropertyBEModel { expandedChildPropertyId: string; - flattenedChildren: Array<DerivedFEProperty>; //[parentPath] : Array<DerivedFEProp> + flattenedChildren: Array<DerivedFEProperty>; isDeclared: boolean; isDisabled: boolean; isSelected: boolean; isSimpleType: boolean; //for convenience only - we can really just check if derivedDataType == derivedPropertyTypes.SIMPLE to know if the prop is simple + propertiesName: string; uniqueId: string; valueObj: any; //this is the only value we relate to in the html templates derivedDataType: DerivedPropertyType; @@ -21,6 +22,7 @@ export class PropertyFEModel extends PropertyBEModel { this.setNonDeclared(); this.derivedDataType = this.getDerivedPropertyType(); this.flattenedChildren = []; + this.propertiesName = this.name; } @@ -29,7 +31,7 @@ export class PropertyFEModel extends PropertyBEModel { //TODO: handle this.derivedDataType == DerivedPropertyType.MAP if (this.derivedDataType == DerivedPropertyType.LIST && this.schema.property.type == PROPERTY_TYPES.JSON) { try { - return JSON.stringify(this.valueObj.map(item => JSON.parse(item))); + return JSON.stringify(this.valueObj.map(item => (typeof item == 'string')? JSON.parse(item) : item)); } catch (e){} } @@ -37,7 +39,7 @@ export class PropertyFEModel extends PropertyBEModel { } public setNonDeclared = (childPath?: string): void => { - if (!childPath) { //declaring a child prop + if (!childPath) { //un-declaring a child prop this.isDeclared = false; } else { let childProp: DerivedFEProperty = this.flattenedChildren.find(child => child.propertiesName == childPath); @@ -51,6 +53,7 @@ export class PropertyFEModel extends PropertyBEModel { this.isDeclared = true; } else { let childProp: DerivedFEProperty = this.flattenedChildren.find(child => child.propertiesName == childNameToDeclare); + if (!childProp) { console.log("ERROR: Unabled to find child: " + childNameToDeclare, this); return; } childProp.isSelected = false; childProp.isDeclared = true; } |