Skip to content

Commit c952c83

Browse files
committed
changes
1 parent 108b3f1 commit c952c83

3 files changed

Lines changed: 31 additions & 41 deletions

File tree

trackio/frontend/src/App.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@
463463
<Runs
464464
project={selectedProject}
465465
{runs}
466+
{filterText}
466467
onRunsChanged={refreshRunsAndMutation}
467468
runMutationAllowed={mutationStatus.allowed}
468469
/>

trackio/frontend/src/components/Sidebar.svelte

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import GradioTextbox from "./GradioTextbox.svelte";
88
import { buildColorMap, getColorForIndex } from "../lib/stores.js";
99
import { latestOnlySelection } from "../lib/selection.js";
10+
import { filterMetricsByRegex } from "../lib/dataProcessing.js";
1011
1112
let {
1213
open = $bindable(true),
@@ -78,11 +79,11 @@
7879
};
7980
}
8081
81-
let filteredRuns = $derived(
82-
filterText
83-
? runs.filter((r) => r.name.toLowerCase().includes(filterText.toLowerCase()))
84-
: runs,
85-
);
82+
let filteredRuns = $derived.by(() => {
83+
if (!filterText || !filterText.trim()) return runs;
84+
const matches = new Set(filterMetricsByRegex(runs.map((r) => r.name), filterText));
85+
return runs.filter((r) => matches.has(r.name));
86+
});
8687
8788
let runColorMap = $derived(buildColorMap(runs));
8889
let filteredRunIds = $derived(filteredRuns.map((r) => r.id ?? r.name));
@@ -240,6 +241,17 @@
240241
{/if}
241242
</div>
242243
244+
{#if variant === "compact" && currentPage === "runs"}
245+
<div class="section">
246+
<GradioTextbox
247+
label="Run Filter"
248+
info="Filter runs using regex patterns. Leave empty to show all runs."
249+
placeholder="e.g., baseline|exp-.*|v2"
250+
bind:value={filterText}
251+
/>
252+
</div>
253+
{/if}
254+
243255
{#if variant === "full"}
244256
{#if currentPage === "metrics" && spacesMode}
245257
<div class="section">

trackio/frontend/src/pages/Runs.svelte

Lines changed: 13 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
import { getProjectSummary, getRunSummary, deleteRun, renameRun } from "../lib/api.js";
55
import { navigateTo, setQueryParam } from "../lib/router.js";
66
import { buildColorMap } from "../lib/stores.js";
7+
import { filterMetricsByRegex } from "../lib/dataProcessing.js";
78
89
let {
910
project = null,
1011
runs = [],
12+
filterText = "",
1113
onRunsChanged = null,
1214
runMutationAllowed = true,
1315
} = $props();
@@ -21,13 +23,12 @@
2123
let renamingIndex = $state(-1);
2224
let renameValue = $state("");
2325
let renameInput = $state(null);
24-
let filterText = $state("");
2526
26-
let filteredRuns = $derived(
27-
filterText
28-
? runsData.filter((r) => r.name.toLowerCase().includes(filterText.toLowerCase()))
29-
: runsData,
30-
);
27+
let filteredRuns = $derived.by(() => {
28+
if (!filterText || !filterText.trim()) return runsData;
29+
const matches = new Set(filterMetricsByRegex(runsData.map((r) => r.name), filterText));
30+
return runsData.filter((r) => matches.has(r.name));
31+
});
3132
3233
async function loadRuns() {
3334
if (!project) {
@@ -117,18 +118,11 @@
117118
<p>Refresh this page or wait for the dashboard to poll; new runs appear in the table with step counts.</p>
118119
</div>
119120
{:else}
120-
<div class="filter-section">
121-
<input
122-
type="text"
123-
class="filter-input"
124-
aria-label="Filter runs"
125-
placeholder="Filter runs..."
126-
bind:value={filterText}
127-
/>
128-
{#if filterText}
121+
{#if filterText}
122+
<div class="filter-count-row">
129123
<span class="filter-count">{filteredRuns.length} of {runsData.length} runs</span>
130-
{/if}
131-
</div>
124+
</div>
125+
{/if}
132126
<table class="runs-table">
133127
<thead>
134128
<tr>
@@ -238,25 +232,8 @@
238232
background: none;
239233
padding: 0;
240234
}
241-
.filter-section {
242-
display: flex;
243-
align-items: center;
244-
gap: 12px;
245-
margin-bottom: 16px;
246-
}
247-
.filter-input {
248-
flex: 1;
249-
max-width: 400px;
250-
padding: 8px 12px;
251-
border: 1px solid var(--border-color-primary, #e5e7eb);
252-
border-radius: var(--radius-sm, 4px);
253-
font-size: var(--text-md, 14px);
254-
background: var(--background-fill-primary, white);
255-
color: var(--body-text-color, #1f2937);
256-
}
257-
.filter-input:focus {
258-
outline: none;
259-
border-color: var(--color-accent, #f97316);
235+
.filter-count-row {
236+
margin-bottom: 12px;
260237
}
261238
.filter-count {
262239
font-size: var(--text-sm, 12px);

0 commit comments

Comments
 (0)