forked from mystiq/hydrogen-web
show object properties in the details of the log viewer
This commit is contained in:
parent
0cbf6008a2
commit
61adca3b10
2 changed files with 11 additions and 2 deletions
|
@ -47,6 +47,7 @@
|
|||
aside .values li span {
|
||||
word-wrap: ;
|
||||
word-wrap: anywhere;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
aside .values {
|
||||
|
@ -63,7 +64,7 @@
|
|||
aside .values span.value {
|
||||
width: 70%;
|
||||
display: block;
|
||||
padding-left: 10px;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
aside .values li {
|
||||
|
|
|
@ -52,6 +52,14 @@ main.addEventListener("click", event => {
|
|||
}
|
||||
});
|
||||
|
||||
function stringifyItemValue(value) {
|
||||
if (typeof value === "object" && value !== null) {
|
||||
return JSON.stringify(value, undefined, 2);
|
||||
} else {
|
||||
return value + "";
|
||||
}
|
||||
}
|
||||
|
||||
function showItemDetails(item, parent, itemNode) {
|
||||
const parentOffset = itemStart(parent) ? `${itemStart(item) - itemStart(parent)}ms` : "none";
|
||||
const expandButton = t.button("Expand recursively");
|
||||
|
@ -68,7 +76,7 @@ function showItemDetails(item, parent, itemNode) {
|
|||
t.ul({class: "values"}, Object.entries(itemValues(item)).map(([key, value]) => {
|
||||
return t.li([
|
||||
t.span({className: "key"}, normalizeValueKey(key)),
|
||||
t.span({className: "value"}, value+"")
|
||||
t.span({className: "value"}, stringifyItemValue(value))
|
||||
]);
|
||||
})),
|
||||
t.p(expandButton)
|
||||
|
|
Loading…
Reference in a new issue