Skip to content

Commit b64d71a

Browse files
committed
feat: move status filter to runs table header row
Status filter now displays inline with 'Recent Evaluation Runs' title - title left-aligned, filter right-aligned. Removed standalone card wrapper from StatusFilter component.
1 parent bd5c795 commit b64d71a

File tree

3 files changed

+49
-60
lines changed

3 files changed

+49
-60
lines changed

src/evaluation-view/EvaluationViewShell.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -484,12 +484,17 @@ export class EvaluationViewShell extends React.Component<
484484
: null
485485
}
486486
/>
487-
<StatusFilter
488-
currentStatus={statusFilter}
489-
onStatusChange={this.handleStatusFilterChange}
490-
counts={statusCounts}
487+
<RunsTable
488+
runs={filteredRuns}
489+
onSelectRun={this.handleSelectRun}
490+
headerActions={
491+
<StatusFilter
492+
currentStatus={statusFilter}
493+
onStatusChange={this.handleStatusFilterChange}
494+
counts={statusCounts}
495+
/>
496+
}
491497
/>
492-
<RunsTable runs={filteredRuns} onSelectRun={this.handleSelectRun} />
493498
</>
494499
)}
495500

src/evaluation-view/components/RunsTable.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ import type { EvaluationRun } from '../evaluationViewTypes';
55
interface RunsTableProps {
66
runs: EvaluationRun[];
77
onSelectRun: (runId: string) => void;
8+
headerActions?: React.ReactNode;
89
}
910

10-
export const RunsTable: React.FC<RunsTableProps> = ({ runs, onSelectRun }) => {
11+
export const RunsTable: React.FC<RunsTableProps> = ({ runs, onSelectRun, headerActions }) => {
1112
const formatDate = (dateString: string): string => {
1213
const date = new Date(dateString);
1314
return date.toLocaleString('en-US', {
@@ -59,10 +60,11 @@ export const RunsTable: React.FC<RunsTableProps> = ({ runs, onSelectRun }) => {
5960
if (runs.length === 0) {
6061
return (
6162
<div className="bg-white dark:bg-gray-800 shadow rounded-lg overflow-hidden">
62-
<div className="px-4 py-5 sm:px-6 border-b border-gray-200 dark:border-gray-700">
63+
<div className="px-4 py-5 sm:px-6 border-b border-gray-200 dark:border-gray-700 flex items-center justify-between">
6364
<h3 className="text-lg leading-6 font-medium text-gray-900 dark:text-white">
6465
Recent Evaluation Runs
6566
</h3>
67+
{headerActions}
6668
</div>
6769
<div className="px-6 py-12 text-center">
6870
<Inbox className="mx-auto h-12 w-12 text-gray-400" />
@@ -79,10 +81,11 @@ export const RunsTable: React.FC<RunsTableProps> = ({ runs, onSelectRun }) => {
7981

8082
return (
8183
<div className="bg-white dark:bg-gray-800 shadow rounded-lg overflow-hidden">
82-
<div className="px-4 py-5 sm:px-6 border-b border-gray-200 dark:border-gray-700">
84+
<div className="px-4 py-5 sm:px-6 border-b border-gray-200 dark:border-gray-700 flex items-center justify-between">
8385
<h3 className="text-lg leading-6 font-medium text-gray-900 dark:text-white">
8486
Recent Evaluation Runs
8587
</h3>
88+
{headerActions}
8689
</div>
8790
<div className="overflow-x-auto">
8891
<table className="min-w-full divide-y divide-gray-200 dark:divide-gray-700">

src/evaluation-view/components/StatusFilter.tsx

Lines changed: 33 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -19,60 +19,41 @@ export const StatusFilter: React.FC<StatusFilterProps> = ({
1919
onStatusChange,
2020
counts,
2121
}) => {
22-
const filters: { value: StatusFilterValue; label: string }[] = [
23-
{ value: 'all', label: 'All' },
24-
{ value: 'pending', label: 'Pending' },
25-
{ value: 'running', label: 'Running' },
26-
{ value: 'completed', label: 'Completed' },
27-
{ value: 'failed', label: 'Failed' },
28-
];
22+
const formatLabel = (value: StatusFilterValue): string => {
23+
if (value === 'all') {
24+
return `All Runs${counts ? ` (${counts.all})` : ''}`;
25+
}
2926

30-
return (
31-
<div className="mb-4 flex items-center gap-2">
32-
<span className="text-sm font-medium text-gray-700 dark:text-gray-300">
33-
Filter by status:
34-
</span>
35-
<div className="inline-flex rounded-md shadow-sm" role="group">
36-
{filters.map((filter, index) => {
37-
const isActive = currentStatus === filter.value;
38-
const count = counts?.[filter.value];
27+
const labels: Record<Exclude<StatusFilterValue, 'all'>, string> = {
28+
pending: 'Pending',
29+
running: 'Running',
30+
completed: 'Completed',
31+
failed: 'Failed',
32+
};
33+
34+
const label = labels[value as Exclude<StatusFilterValue, 'all'>];
35+
const count = counts?.[value];
3936

40-
return (
41-
<button
42-
key={filter.value}
43-
type="button"
44-
onClick={() => onStatusChange(filter.value)}
45-
className={`
46-
px-4 py-2 text-sm font-medium
47-
${index === 0 ? 'rounded-l-lg' : ''}
48-
${index === filters.length - 1 ? 'rounded-r-lg' : ''}
49-
${
50-
isActive
51-
? 'bg-blue-600 text-white hover:bg-blue-700 dark:bg-blue-700 dark:hover:bg-blue-800'
52-
: 'bg-white text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700'
53-
}
54-
border border-gray-300 dark:border-gray-600
55-
${index !== 0 ? 'border-l-0' : ''}
56-
focus:z-10 focus:ring-2 focus:ring-blue-500 focus:outline-none
57-
transition-colors duration-200
58-
`}
59-
>
60-
{filter.label}
61-
{count !== undefined && count > 0 && (
62-
<span
63-
className={`ml-2 px-2 py-0.5 text-xs rounded-full ${
64-
isActive
65-
? 'bg-blue-500 text-white'
66-
: 'bg-gray-200 text-gray-700 dark:bg-gray-700 dark:text-gray-300'
67-
}`}
68-
>
69-
{count}
70-
</span>
71-
)}
72-
</button>
73-
);
74-
})}
75-
</div>
37+
return count !== undefined ? `${label} (${count})` : label;
38+
};
39+
40+
return (
41+
<div className="flex items-center gap-2">
42+
<label htmlFor="status-filter" className="text-sm font-medium text-gray-700 dark:text-gray-300">
43+
Status:
44+
</label>
45+
<select
46+
id="status-filter"
47+
value={currentStatus}
48+
onChange={(e) => onStatusChange(e.target.value as StatusFilterValue)}
49+
className="rounded-md border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white shadow-sm focus:border-blue-500 focus:ring-blue-500 px-3 py-2"
50+
>
51+
<option value="all">{formatLabel('all')}</option>
52+
<option value="pending">{formatLabel('pending')}</option>
53+
<option value="running">{formatLabel('running')}</option>
54+
<option value="completed">{formatLabel('completed')}</option>
55+
<option value="failed">{formatLabel('failed')}</option>
56+
</select>
7657
</div>
7758
);
7859
};

0 commit comments

Comments
 (0)