Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Adds JSON view for numeric list -- this is easier to deal with #154

Merged
merged 2 commits into from
Apr 14, 2024
Merged
Changes from all commits
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
20 changes: 11 additions & 9 deletions telemetry/ui/src/components/routes/app/DataView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,13 @@ const RenderedField = (props: {
<>
<Header name={key} isExpanded={isExpanded} setExpanded={setExpanded} />
{isExpanded &&
(typeof value === 'string' ? (
(props.value instanceof Array &&
props.value.length > 0 &&
typeof props.value[0] === 'number' ? (
<div key={key + '-' + String(level)}>
<JsonView value={props.value} enableClipboard={false} collapsed={1} />
</div>
) : typeof value === 'string' ? (
<div key={key + '-' + String(level)}>
<pre
className={bodyClassNames}
Expand Down Expand Up @@ -290,10 +296,10 @@ const RenderedField = (props: {
<span>NULL</span>
) : (
Object.entries(value).map(([k, v]) => {
if (v instanceof Array && v.length > 0 && typeof v[0] === 'number') {
// we want to display arrays of numbers as a single string.
v = v.toString();
}
// if (v instanceof Array && v.length > 0 && typeof v[0] === 'number') {
// // we want to display arrays of numbers as a single string.
// v = v.toString();
// }
return (
<div key={key + '-' + k} className={bodyClassNames}>
<RenderedField
Expand Down Expand Up @@ -332,10 +338,6 @@ const FormRenderer: React.FC<FormRendererProps> = ({ data, isDefaultExpanded: is
return (
<>
{Object.entries(data).map(([key, value]) => {
if (value instanceof Array && value.length > 0 && typeof value[0] === 'number') {
// we want to display arrays of numbers as a single string.
value = value.toString();
}
return (
<RenderedField
keyName={key}
Expand Down
Loading