Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
coveredEntities = [this.HierarchyControl.EntityId];
return [4 /*yield*/, here.getFamilyConnections(here.HierarchyControl.EntityId, 0, coveredEntities)];
case 1:
results = _b.sent();
for (_i = 0, _a = results.entities; _i < _a.length; _i++) {
entity = _a[_i];
he = this.parseJSONResponse(entity);
if (self_node.Line1 === undefined) {
self_node.Line1 = entity["from.fullname"];
}
if (entity._record2roleid_value === ConnectionRole.Parent.toLowerCase() || entity._record1roleid_value === ConnectionRole.Child.toLowerCase()) {
self_node.HierarchyParentEntityId = entity["to.contactid"];
// TODO: Replace placeholder with parent label
he.Line2 = "Parent";
}
if (entity["from.contactid"] === this.HierarchyControl.EntityId && self_node.ImgUrl === undefined) {
self_node.ImgUrl = entity["from.entityimage"] !== undefined ? "data:image/png;base64," + entity["from.entityimage"] : "";
}
hierarchyElements.push(he);
}
hierarchyElements.push(self_node);
this.HierarchyElements = hierarchyElements;
return [2 /*return*/, 0];
}
});
});
HouseholdHierarchyDataLoader.prototype.parseJSONResponse = function (obj) {
var node = new HierarchyNode();
if (obj._record2roleid_value === ConnectionRole.Child.toLowerCase()) {
node.HierarchyParentEntityId = obj["from.contactid"];
}
else if (obj._record2roleid_value === ConnectionRole.Parent.toLowerCase()) {
node.HierarchyParentEntityId = obj["to.contactid"];
}
node.HierarchyEntityId = obj._record2id_value;
node.EntityId = node.HierarchyEntityId;
node.Line1 = obj["to.fullname"];
node.Line2 = obj["_record2roleid_value@OData.Community.Display.V1.FormattedValue"] === undefined ?
"Unspecified" : obj["_record2roleid_value@OData.Community.Display.V1.FormattedValue"];
node.Line3 = "";
node.ImgUrl = obj["to.entityimage"] !== undefined ? "data:image/png;base64," + obj["to.entityimage"] : "";
node.Url = Common.Instance.getLink(node.EntityId, this.HierarchyControl.EntityName, this.HierarchyControl.Context);
if (node.ImgUrl === undefined || node.ImgUrl === null || node.ImgUrl === "") {
node.ImgUrl = this.HierarchyControl.DefaultImage;
}
if (obj._record2roleid_value === ConnectionRole.Partner.toLowerCase() || obj._record1roleid_value === ConnectionRole.Partner.toLowerCase()) {