Skip to content

Commit

Permalink
Merge pull request #14 from chkp-maxcalderon/master
Browse files Browse the repository at this point in the history
changed arrays of uids to arrays of names
  • Loading branch information
chkp-amiads authored Jul 15, 2019
2 parents 4e238bb + df3f826 commit 0d546d4
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
rowElement.appendChild(indexElement);

var valueElement = document.createElement("td");
printChildElement(elem, valueElement, level);
printChildElement(elem, valueElement, level, true);
rowElement.appendChild(valueElement);
tableElement.appendChild(rowElement);
});
Expand All @@ -133,7 +133,7 @@
function printObject(obj, parentObject, level) {

if (typeof(obj) !== "object") {
parentObject.appendChild(generateValueNode(obj.toString()));
parentObject.appendChild(generateValueNode(obj.toString(), false));
return;
}

Expand All @@ -154,7 +154,7 @@
rowElement.appendChild(keyElement);

var valueElement = document.createElement("td");
printChildElement(obj[key], valueElement, level);
printChildElement(obj[key], valueElement, level, false);
rowElement.appendChild(valueElement);

tableElement.appendChild(rowElement);
Expand All @@ -163,7 +163,7 @@
parentObject.appendChild(tableElement);
}

function printChildElement(elem, parent, level) {
function printChildElement(elem, parent, level, isArray) {
switch (Object.prototype.toString.call((elem))) {
case "[object Object]":
parent.className = "object_value";
Expand All @@ -174,7 +174,7 @@
printArray(elem, parent, level + 1);
break;
default:
parent.appendChild(generateValueNode(elem));
parent.appendChild(generateValueNode(elem, isArray));
}
}

Expand Down Expand Up @@ -240,13 +240,14 @@
};
}();

function generateValueNode(value) {
function generateValueNode(value, isArray) {
var valueNode;
if (isUUID(value) && objectsMap[value] && getQueryParams()["uid"] !== value) {
valueNode = document.createElement("a");
valueNode.className = "object_link";
valueNode.setAttribute("href", getLinkBase() + value);
valueNode.setAttribute("target", "_blank");
var child = isArray ? document.createTextNode(objectsMap[value].name) : document.createTextNode(value);
valueNode.appendChild(document.createTextNode(value));
} else {
valueNode = document.createTextNode(value)
Expand Down

0 comments on commit 0d546d4

Please sign in to comment.