Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ import { isObject } from 'lodash';
import { EditNamespaceDialog } from './edit-namespace-dialog';
import { EditRowDialog, isEditableExplorerAttr } from './edit-row-dialog';
import copy from 'copy-to-clipboard';
import { formatVal } from './format-value';

const fallbackItems: any[] = [];

Expand Down Expand Up @@ -539,10 +540,7 @@ export const InnerExplorer: React.FC<{
return info.row.original[attr.name];
}
}
if (isObject(info.row.original[attr.name])) {
return <Val data={info.row.original[attr.name]}></Val>;
}
return info.row.original[attr.name];
return formatVal(info.row.original[attr.name]);
},
});
});
Expand Down Expand Up @@ -1469,14 +1467,6 @@ export const InnerExplorer: React.FC<{
);
};

function formatVal(data: any, pretty?: boolean): string {
if (isObject(data)) {
return JSON.stringify(data, null, pretty ? 2 : undefined);
}

return String(data);
}

function Val({ data, pretty }: { data: any; pretty?: boolean }) {
const props = useExplorerProps();
const sanitized = formatVal(data, pretty);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { isObject } from 'lodash';
import copy from 'copy-to-clipboard';
import { useExplorerDialog, useExplorerProps, useExplorerState } from '.';
import { TableColMeta } from './inner-explorer';
import { formatVal } from './format-value';

export const TableHeader = ({
header,
Expand Down Expand Up @@ -397,14 +398,6 @@ function isCopyableCellValue(
return true;
}

function formatVal(data: any, pretty?: boolean): string {
if (isObject(data)) {
return JSON.stringify(data, null, pretty ? 2 : undefined);
}

return String(data);
}

function Val({ data, pretty }: { data: any; pretty?: boolean }) {
const sanitized = formatVal(data, pretty);
const explorerProps = useExplorerProps();
Expand Down
Loading