Skip to content

Commit a5a3c3b

Browse files
committed
Basic filter bar and beta flag
1 parent 682be80 commit a5a3c3b

3 files changed

Lines changed: 63 additions & 1 deletion

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { useState } from "react";
2+
3+
import { Button } from "@/components/ui/button";
4+
import { Icon } from "@/components/ui/icon";
5+
import { Input } from "@/components/ui/input";
6+
import { BlockStack, InlineStack } from "@/components/ui/layout";
7+
import { useRunSearchParams } from "@/hooks/useRunSearchParams";
8+
9+
export function PipelineRunFiltersBar() {
10+
const { filters, setFilter, setFilterDebounced } = useRunSearchParams();
11+
12+
const [nameInput, setNameInput] = useState(filters.pipeline_name ?? "");
13+
14+
return (
15+
<BlockStack gap="3">
16+
<InlineStack gap="3" align="center">
17+
<div className="relative flex-1 min-w-0">
18+
<Icon
19+
name="Search"
20+
className="absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"
21+
/>
22+
<Input
23+
placeholder="Search by pipeline name..."
24+
value={nameInput}
25+
onChange={(e) => {
26+
setNameInput(e.target.value);
27+
setFilterDebounced("pipeline_name", e.target.value);
28+
}}
29+
className="pl-9 pr-8 w-full"
30+
/>
31+
{nameInput && (
32+
<Button
33+
variant="ghost"
34+
size="icon"
35+
onClick={() => {
36+
setNameInput("");
37+
setFilter("pipeline_name", undefined);
38+
}}
39+
className="absolute right-2 top-1/2 -translate-y-1/2 size-6 text-muted-foreground hover:text-foreground"
40+
aria-label="Clear search"
41+
>
42+
<Icon name="X" size="sm" />
43+
</Button>
44+
)}
45+
</div>
46+
</InlineStack>
47+
</BlockStack>
48+
);
49+
}

src/flags.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,12 @@ export const ExistingFlags: ConfigFlags = {
6565
default: false,
6666
category: "beta",
6767
},
68+
69+
["pipeline-run-filters-bar"]: {
70+
name: "Pipeline run filters bar (UI only)",
71+
description:
72+
"Non-functional UI preview. This filter bar is not connected to the API and is for testing/development purposes only.",
73+
default: false,
74+
category: "beta",
75+
},
6876
};

src/routes/Home/Home.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import { useRef, useState } from "react";
22

33
import { PipelineSection, RunSection } from "@/components/Home";
4+
import { PipelineRunFiltersBar } from "@/components/shared/PipelineRunFiltersBar/PipelineRunFiltersBar";
5+
import { useFlagValue } from "@/components/shared/Settings/useFlags";
46
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
57

68
const Home = () => {
79
const [activeTab, setActiveTab] = useState("runs");
10+
const isFiltersBarEnabled = useFlagValue("pipeline-run-filters-bar");
11+
812
const handleTabSelect = (value: string) => {
913
setActiveTab(value);
1014
};
@@ -35,7 +39,8 @@ const Home = () => {
3539
<TabsContent value="pipelines">
3640
<PipelineSection />
3741
</TabsContent>
38-
<TabsContent value="runs" className="flex flex-col gap-1">
42+
<TabsContent value="runs" className="flex flex-col gap-4">
43+
{isFiltersBarEnabled && <PipelineRunFiltersBar />}
3944
<RunSection onEmptyList={handlePipelineRunsEmpty} />
4045
</TabsContent>
4146
</Tabs>

0 commit comments

Comments
 (0)