Skip to content

Commit 05397ae

Browse files
authored
[OPIK-3506] [UX] Update AddEditCloneDashboardDialog footer UX: conditionally render "Cancel" button on DETAILS step (#4513)
1. Fixed metric type naming consistency: Updated all metric labels to match between dropdown and widget titles: - "Trace feedback scores" → "Trace metrics" (both places) - "Trace count" → "Number of traces" (both places) - "Thread feedback scores" → "Thread metrics" (both places) - "Thread count" → "Number of threads" (both places) 2. Added tooltips to widget name and description: When text is truncated, users can now hover to see the full content 3. Fixed Reset button behavior: Clicking Reset now closes edit mode immediately instead of keeping the input active 4. Improved group title clarity: Changed "by X" to "grouped by X" in experiment widgets for better readability (e.g., "Filtered metrics grouped by Dataset")
1 parent eb7b581 commit 05397ae

File tree

5 files changed

+48
-42
lines changed

5 files changed

+48
-42
lines changed

apps/opik-frontend/src/components/pages-shared/dashboards/AddEditCloneDashboardDialog/AddEditCloneDashboardDialog.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ const AddEditCloneDashboardDialog: React.FC<
369369
)}
370370
</DialogAutoScrollBody>
371371

372-
<DialogFooter className="flex flex-row justify-between gap-2 border-t pt-4 sm:flex-row sm:justify-between">
372+
<DialogFooter className="flex flex-row justify-between gap-2 sm:flex-row sm:justify-between">
373373
<div>
374374
{isCreateMode && currentStep === DialogStep.DETAILS && (
375375
<Button variant="outline" onClick={handleBack}>
@@ -380,11 +380,13 @@ const AddEditCloneDashboardDialog: React.FC<
380380
</div>
381381

382382
<div className="flex gap-2">
383-
<DialogClose asChild>
384-
<Button variant="outline" disabled={isPending}>
385-
Cancel
386-
</Button>
387-
</DialogClose>
383+
{currentStep === DialogStep.DETAILS && (
384+
<DialogClose asChild>
385+
<Button variant="outline" disabled={isPending}>
386+
Cancel
387+
</Button>
388+
</DialogClose>
389+
)}
388390

389391
{currentStep === DialogStep.DETAILS && (
390392
<Button type="submit" form="dashboard-form" disabled={isPending}>

apps/opik-frontend/src/components/shared/Dashboard/widgets/ExperimentsFeedbackScoresWidget/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ const buildFilterAndGroupTitle = (
7979
}
8080

8181
if (hasGroups && groupByLabel) {
82-
return `${baseLabel} by ${groupByLabel}`;
82+
return `${baseLabel} grouped by ${groupByLabel}`;
8383
}
8484

8585
return baseLabel;

apps/opik-frontend/src/components/shared/Dashboard/widgets/ProjectMetricsWidget/ProjectMetricsEditor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ import { CHART_TYPE } from "@/constants/chart";
5454
const METRIC_OPTIONS = [
5555
{
5656
value: METRIC_NAME_TYPE.FEEDBACK_SCORES,
57-
label: "Trace feedback scores",
57+
label: "Trace metrics",
5858
filterType: "trace" as const,
5959
},
6060
{
@@ -94,7 +94,7 @@ const METRIC_OPTIONS = [
9494
},
9595
{
9696
value: METRIC_NAME_TYPE.THREAD_FEEDBACK_SCORES,
97-
label: "Thread feedback scores",
97+
label: "Thread metrics",
9898
filterType: "thread" as const,
9999
},
100100
];

apps/opik-frontend/src/components/shared/Dashboard/widgets/ProjectMetricsWidget/helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ const DEFAULT_TITLE = "Project metrics";
66

77
const METRIC_LABELS: Record<string, string> = {
88
[METRIC_NAME_TYPE.FEEDBACK_SCORES]: "Trace metrics",
9-
[METRIC_NAME_TYPE.TRACE_COUNT]: "Trace count",
9+
[METRIC_NAME_TYPE.TRACE_COUNT]: "Number of traces",
1010
[METRIC_NAME_TYPE.TRACE_DURATION]: "Trace duration",
1111
[METRIC_NAME_TYPE.TOKEN_USAGE]: "Token usage",
1212
[METRIC_NAME_TYPE.COST]: "Estimated cost",
1313
[METRIC_NAME_TYPE.FAILED_GUARDRAILS]: "Failed guardrails",
14-
[METRIC_NAME_TYPE.THREAD_COUNT]: "Thread count",
14+
[METRIC_NAME_TYPE.THREAD_COUNT]: "Number of threads",
1515
[METRIC_NAME_TYPE.THREAD_DURATION]: "Thread duration",
1616
[METRIC_NAME_TYPE.THREAD_FEEDBACK_SCORES]: "Thread metrics",
1717
};

apps/opik-frontend/src/components/shared/InlineEditableText/InlineEditableText.tsx

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ const InlineEditableText: React.FunctionComponent<InlineEditableTextProps> = ({
5555
const handleReset = useCallback(() => {
5656
if (defaultValue !== undefined) {
5757
setEditValue(defaultValue);
58+
onChange("");
59+
setIsEditing(false);
5860
}
59-
}, [defaultValue]);
61+
}, [defaultValue, onChange]);
6062

6163
const handleKeyDown = useCallback(
6264
(e: React.KeyboardEvent<HTMLInputElement>) => {
@@ -152,38 +154,40 @@ const InlineEditableText: React.FunctionComponent<InlineEditableTextProps> = ({
152154

153155
// Default/Hover state
154156
return (
155-
<div
156-
className={cn(
157-
"group/inline-edit flex h-8 cursor-pointer items-center gap-1 overflow-hidden rounded-md transition-colors hover:bg-muted",
158-
className,
159-
)}
160-
onClick={handleStartEdit}
161-
role="button"
162-
tabIndex={0}
163-
onKeyDown={(e) => {
164-
if (e.key === "Enter" || e.key === " ") {
165-
e.preventDefault();
166-
handleStartEdit();
167-
}
168-
}}
169-
>
170-
<div className="min-w-0 flex-1 pl-2">
171-
<span
172-
className={cn(
173-
"block truncate text-sm leading-5",
174-
isTitle ? "font-medium text-foreground" : "text-foreground",
175-
!value && "text-muted-slate",
176-
)}
177-
>
178-
{displayValue}
179-
</span>
180-
</div>
181-
<div className="hidden h-full items-center pr-2 group-hover/inline-edit:flex">
182-
<div className="flex size-7 items-center justify-center rounded">
183-
<Pencil className="size-3.5 text-foreground" />
157+
<TooltipWrapper content={displayValue} side="top">
158+
<div
159+
className={cn(
160+
"group/inline-edit flex h-8 cursor-pointer items-center gap-1 overflow-hidden rounded-md transition-colors hover:bg-muted",
161+
className,
162+
)}
163+
onClick={handleStartEdit}
164+
role="button"
165+
tabIndex={0}
166+
onKeyDown={(e) => {
167+
if (e.key === "Enter" || e.key === " ") {
168+
e.preventDefault();
169+
handleStartEdit();
170+
}
171+
}}
172+
>
173+
<div className="min-w-0 flex-1 pl-2">
174+
<span
175+
className={cn(
176+
"block truncate text-sm leading-5",
177+
isTitle ? "font-medium text-foreground" : "text-foreground",
178+
!value && "text-muted-slate",
179+
)}
180+
>
181+
{displayValue}
182+
</span>
183+
</div>
184+
<div className="hidden h-full items-center pr-2 group-hover/inline-edit:flex">
185+
<div className="flex size-7 items-center justify-center rounded">
186+
<Pencil className="size-3.5 text-foreground" />
187+
</div>
184188
</div>
185189
</div>
186-
</div>
190+
</TooltipWrapper>
187191
);
188192
};
189193

0 commit comments

Comments
 (0)