From 4c2839f633628f4f678bf5b1df093f49631da4f5 Mon Sep 17 00:00:00 2001 From: Alex Ray Date: Tue, 16 Jun 2026 15:45:01 -0700 Subject: [PATCH 1/2] refactor(studio): replace deprecated ReadOnlyField with KVPair (ASTD-227) Migrate all usages of the deprecated ReadOnlyField component to KVPair from @nemo/common and delete the deprecated file. Signed-off-by: Alex Ray --- .../src/components/common/ReadOnlyField.tsx | 39 ---------------- .../ConfigurationDetailsPanel.tsx | 8 ++-- .../Configurations/LLMJudgeDisplay.tsx | 16 +++---- .../Configurations/MetricDisplay.tsx | 44 +++++++++---------- .../evaluation/Configurations/TaskDisplay.tsx | 8 ++-- 5 files changed, 36 insertions(+), 79 deletions(-) delete mode 100644 web/packages/studio/src/components/common/ReadOnlyField.tsx diff --git a/web/packages/studio/src/components/common/ReadOnlyField.tsx b/web/packages/studio/src/components/common/ReadOnlyField.tsx deleted file mode 100644 index 4e129454c1..0000000000 --- a/web/packages/studio/src/components/common/ReadOnlyField.tsx +++ /dev/null @@ -1,39 +0,0 @@ -// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 - -import { Flex, Text } from '@nvidia/foundations-react-core'; -import { FC, ReactNode } from 'react'; - -export interface ReadOnlyFieldProps { - label: string; - value: ReactNode; - className?: string; - /** Vertical alignment of label and value. Defaults to "start" for better multi-line content support */ - align?: 'start' | 'center' | 'end'; -} - -// TODO: Remove this component in issue #1132 -/** - * A reusable component for displaying label/value pairs in read-only mode. - * Uses tabular layout with fixed label width and aligned values. - * - * @deprecated Use KVPair from @nemo/common instead. This component will be removed in a future release. - * Import: `import { KVPair } from '@nemo/common/src/components/KVPair';` - */ -export const ReadOnlyField: FC = ({ - label, - value, - className, - align = 'start', -}) => { - return ( - - - {label} - - - {value || '-'} - - - ); -}; diff --git a/web/packages/studio/src/components/evaluation/Configurations/ConfigurationDetailsPanel.tsx b/web/packages/studio/src/components/evaluation/Configurations/ConfigurationDetailsPanel.tsx index b6b644a274..4583343828 100644 --- a/web/packages/studio/src/components/evaluation/Configurations/ConfigurationDetailsPanel.tsx +++ b/web/packages/studio/src/components/evaluation/Configurations/ConfigurationDetailsPanel.tsx @@ -1,8 +1,8 @@ // SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 +import { KVPair } from '@nemo/common/src/components/KVPair'; import { Divider, Stack, Tag, Text } from '@nvidia/foundations-react-core'; -import { ReadOnlyField } from '@studio/components/common/ReadOnlyField'; import { TaskDisplay } from '@studio/components/evaluation/Configurations/TaskDisplay'; import { useWorkspaceFromPath } from '@studio/hooks/useWorkspaceFromPath'; import { @@ -48,11 +48,11 @@ export const ConfigurationDetailsPanel: FC = ({ return ( - - + + {tags && tags.length > 0 && ( - diff --git a/web/packages/studio/src/components/evaluation/Configurations/LLMJudgeDisplay.tsx b/web/packages/studio/src/components/evaluation/Configurations/LLMJudgeDisplay.tsx index 8614e6e4d6..620e950f12 100644 --- a/web/packages/studio/src/components/evaluation/Configurations/LLMJudgeDisplay.tsx +++ b/web/packages/studio/src/components/evaluation/Configurations/LLMJudgeDisplay.tsx @@ -1,9 +1,9 @@ // SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 +import { KVPair } from '@nemo/common/src/components/KVPair'; import { Stack, Text } from '@nvidia/foundations-react-core'; import { Pre } from '@studio/components/common/Pre'; -import { ReadOnlyField } from '@studio/components/common/ReadOnlyField'; import { FC } from 'react'; const getStr = (params: Record | undefined, key: string): string | undefined => { @@ -46,20 +46,20 @@ export const LLMJudgeDisplay: FC = ({ metricName, metricCo return ( {metricName} - + - - + {systemMessage} : '-'} + value={systemMessage ?
{systemMessage}
: undefined} /> - {userMessage} : '-'} /> + {userMessage} : undefined} />
- - + +
); diff --git a/web/packages/studio/src/components/evaluation/Configurations/MetricDisplay.tsx b/web/packages/studio/src/components/evaluation/Configurations/MetricDisplay.tsx index 7ff81bf965..362b0c9eea 100644 --- a/web/packages/studio/src/components/evaluation/Configurations/MetricDisplay.tsx +++ b/web/packages/studio/src/components/evaluation/Configurations/MetricDisplay.tsx @@ -1,9 +1,9 @@ // SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 +import { KVPair } from '@nemo/common/src/components/KVPair'; import { Stack, Text } from '@nvidia/foundations-react-core'; import { Pre } from '@studio/components/common/Pre'; -import { ReadOnlyField } from '@studio/components/common/ReadOnlyField'; import { FC } from 'react'; export interface MetricDisplayProps { @@ -28,69 +28,65 @@ export const MetricDisplay: FC = ({ metricName, metricConfig return ( {metricName} - + {type === 'string-check' && ( - {params.check.join(',')} - ) : ( - String(params.check) - ) - ) : ( - '-' - ) + params.check + ? Array.isArray(params.check) + ? params.check.join(',') + : String(params.check) + : undefined } /> )} {type === 'bleu' && ( <> - {String(params.references)} : '-'} + value={params.references ?
{String(params.references)}
: undefined} /> {params.candidate && ( - {String(params.candidate)}} /> + {String(params.candidate)}} /> )} )} {type === 'rouge' && ( <> - {String(params.ground_truth)} : '-'} + value={params.ground_truth ?
{String(params.ground_truth)}
: undefined} /> {params.prediction && ( - {String(params.prediction)}} /> + {String(params.prediction)}} /> )} )} {type === 'em' && ( <> - {String(params.ground_truth)} : '-'} + value={params.ground_truth ?
{String(params.ground_truth)}
: undefined} /> {params.prediction && ( - {String(params.prediction)}} /> + {String(params.prediction)}} /> )} )} {type === 'f1' && ( <> - {String(params.ground_truth)} : '-'} + value={params.ground_truth ?
{String(params.ground_truth)}
: undefined} /> {params.prediction && ( - {String(params.prediction)}} /> + {String(params.prediction)}} /> )} )} diff --git a/web/packages/studio/src/components/evaluation/Configurations/TaskDisplay.tsx b/web/packages/studio/src/components/evaluation/Configurations/TaskDisplay.tsx index 87575b1f1a..3434914de0 100644 --- a/web/packages/studio/src/components/evaluation/Configurations/TaskDisplay.tsx +++ b/web/packages/studio/src/components/evaluation/Configurations/TaskDisplay.tsx @@ -1,8 +1,8 @@ // SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 +import { KVPair } from '@nemo/common/src/components/KVPair'; import { Stack, Text } from '@nvidia/foundations-react-core'; -import { ReadOnlyField } from '@studio/components/common/ReadOnlyField'; import { LLMJudgeDisplay } from '@studio/components/evaluation/Configurations/LLMJudgeDisplay'; import { MetricDisplay } from '@studio/components/evaluation/Configurations/MetricDisplay'; import { DatasetFileLink } from '@studio/components/evaluation/DatasetFileLink'; @@ -36,10 +36,10 @@ export const TaskDisplay: FC<{ return ( - - + + {filesetInfo && ( - } /> From 156908a7a2d4f08c16fe35972ad6eacf6281a8eb Mon Sep 17 00:00:00 2001 From: Alex Ray Date: Mon, 22 Jun 2026 10:30:50 -0700 Subject: [PATCH 2/2] fix(studio): use nullish checks for metric params to preserve falsy values (ASTD-227) Signed-off-by: Alex Ray --- .../Configurations/MetricDisplay.tsx | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/web/packages/studio/src/components/evaluation/Configurations/MetricDisplay.tsx b/web/packages/studio/src/components/evaluation/Configurations/MetricDisplay.tsx index 362b0c9eea..c93f312d73 100644 --- a/web/packages/studio/src/components/evaluation/Configurations/MetricDisplay.tsx +++ b/web/packages/studio/src/components/evaluation/Configurations/MetricDisplay.tsx @@ -34,7 +34,7 @@ export const MetricDisplay: FC = ({ metricName, metricConfig = ({ metricName, metricConfig <> {String(params.references)} : undefined} + value={params.references != null ?
{String(params.references)}
: undefined} /> - {params.candidate && ( + {params.candidate != null && ( {String(params.candidate)}} /> )} @@ -59,9 +59,11 @@ export const MetricDisplay: FC = ({ metricName, metricConfig <> {String(params.ground_truth)} : undefined} + value={ + params.ground_truth != null ?
{String(params.ground_truth)}
: undefined + } /> - {params.prediction && ( + {params.prediction != null && ( {String(params.prediction)}} /> )} @@ -71,9 +73,11 @@ export const MetricDisplay: FC = ({ metricName, metricConfig <> {String(params.ground_truth)} : undefined} + value={ + params.ground_truth != null ?
{String(params.ground_truth)}
: undefined + } /> - {params.prediction && ( + {params.prediction != null && ( {String(params.prediction)}} /> )} @@ -83,9 +87,11 @@ export const MetricDisplay: FC = ({ metricName, metricConfig <> {String(params.ground_truth)} : undefined} + value={ + params.ground_truth != null ?
{String(params.ground_truth)}
: undefined + } /> - {params.prediction && ( + {params.prediction != null && ( {String(params.prediction)}} /> )}