mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] devtools: show objects class name and add special extension cases
This commit ensures that class names are displayed for non generic objects and extensions of generic classes will have custom display for their content.
This commit is contained in:
committed by
Géry Debongnie
parent
15c2604df1
commit
04c2808701
@@ -109,6 +109,13 @@
|
|||||||
object(obj) {
|
object(obj) {
|
||||||
const result = [];
|
const result = [];
|
||||||
let length = 0;
|
let length = 0;
|
||||||
|
if (obj instanceof String) {
|
||||||
|
result[0] = `'${obj.toString()}'`;
|
||||||
|
} else if (obj instanceof Array) {
|
||||||
|
return `${obj.constructor.name} ${this.array([...obj])}`;
|
||||||
|
} else if (obj instanceof Number) {
|
||||||
|
result[0] = obj.toString();
|
||||||
|
} else {
|
||||||
for (const [key, value] of Object.entries(obj)) {
|
for (const [key, value] of Object.entries(obj)) {
|
||||||
if (length > 25) {
|
if (length > 25) {
|
||||||
result.push("...");
|
result.push("...");
|
||||||
@@ -127,6 +134,10 @@
|
|||||||
length += element.length;
|
length += element.length;
|
||||||
result.push(element);
|
result.push(element);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (obj.constructor.name !== "Object") {
|
||||||
|
return obj.constructor.name + " {" + result.join(", ") + "}";
|
||||||
|
}
|
||||||
return "{" + result.join(", ") + "}";
|
return "{" + result.join(", ") + "}";
|
||||||
},
|
},
|
||||||
map(obj) {
|
map(obj) {
|
||||||
@@ -823,7 +834,7 @@
|
|||||||
child.contentType = "set";
|
child.contentType = "set";
|
||||||
child.hasChildren = true;
|
child.hasChildren = true;
|
||||||
break;
|
break;
|
||||||
case obj instanceof Array:
|
case obj.constructor.name === "Array":
|
||||||
child.contentType = "array";
|
child.contentType = "array";
|
||||||
child.hasChildren = obj.length > 0;
|
child.hasChildren = obj.length > 0;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user