Stringify children only if value is object or array

Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
Lauri Nevala committed 2020-12-18 13:32:15 +02:00
1 parent ed2703c424
commit 97135666af
1 file changed
+11 -3
@@ -92,10 +92,18 @@ export class CrdResources extends React.Component<Props> {
renderTableContents={(crdInstance: KubeObject) => [ renderTableContents={(crdInstance: KubeObject) => [
crdInstance.getName(), crdInstance.getName(),
isNamespaced && crdInstance.getNs(), isNamespaced && crdInstance.getNs(),
...extraColumns.map(column => ({ ...extraColumns.map((column) => {
let value = jsonPath.value(crdInstance, parseJsonPath(column.jsonPath.slice(1)));
if (Array.isArray(value) || typeof value === "object") {
value = JSON.stringify(value);
}
return {
renderBoolean: true, renderBoolean: true,
children: JSON.stringify(jsonPath.value(crdInstance, parseJsonPath(column.jsonPath.slice(1)))), children: value,
})), };
}),
crdInstance.getAge(), crdInstance.getAge(),
]} ]}
/> />