-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UI v2] feat: Start transition flow runs list form data table to cards (
- Loading branch information
1 parent
6d0ec74
commit 27e85f9
Showing
19 changed files
with
1,148 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
ui-v2/src/components/flow-runs/flow-runs-list/flow-run-card.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { components } from "@/api/prefect"; | ||
import { Card } from "@/components/ui/card"; | ||
import { Checkbox } from "@/components/ui/checkbox"; | ||
import { Typography } from "@/components/ui/typography"; | ||
import { cva } from "class-variance-authority"; | ||
import type { FlowRunRow } from "./types"; | ||
|
||
type FlowRunCardProps = | ||
| { | ||
flowRun: FlowRunRow; | ||
} | ||
| { | ||
flowRun: FlowRunRow; | ||
checked: boolean; | ||
onCheckedChange: (checked: boolean) => void; | ||
}; | ||
|
||
export const FlowRunCard = ({ flowRun, ...props }: FlowRunCardProps) => { | ||
return ( | ||
<Card className={stateCardVariants({ state: flowRun.state?.type })}> | ||
<div className="flex items-center gap-2"> | ||
{"checked" in props && "onCheckedChange" in props && ( | ||
<Checkbox | ||
checked={props.checked} | ||
onCheckedChange={props.onCheckedChange} | ||
/> | ||
)} | ||
<Typography>{flowRun.name}</Typography> | ||
</div> | ||
</Card> | ||
); | ||
}; | ||
|
||
const stateCardVariants = cva("flex flex-col gap-2 p-4 border-l-8", { | ||
variants: { | ||
state: { | ||
COMPLETED: "border-l-green-600", | ||
FAILED: "border-l-red-600", | ||
RUNNING: "border-l-blue-700", | ||
CANCELLED: "border-l-gray-800", | ||
CANCELLING: "border-l-gray-800", | ||
CRASHED: "border-l-orange-600", | ||
PAUSED: "border-l-gray-800", | ||
PENDING: "border-l-gray-800", | ||
SCHEDULED: "border-l-yellow-700", | ||
} satisfies Record<components["schemas"]["StateType"], string>, | ||
}, | ||
}); |
47 changes: 47 additions & 0 deletions
47
ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-filters.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { RunNameSearch } from "./flow-runs-filters/run-name-search"; | ||
import { SortFilter } from "./flow-runs-filters/sort-filter"; | ||
import type { SortFilters } from "./flow-runs-filters/sort-filter.constants"; | ||
import { StateFilter } from "./flow-runs-filters/state-filter"; | ||
import type { FlowRunState } from "./flow-runs-filters/state-filters.constants"; | ||
|
||
export type FlowRunsFiltersProps = { | ||
search: { | ||
onChange: (value: string) => void; | ||
value: string; | ||
}; | ||
stateFilter: { | ||
value: Set<FlowRunState>; | ||
onSelect: (filters: Set<FlowRunState>) => void; | ||
}; | ||
sort: { | ||
value: SortFilters | undefined; | ||
onSelect: (sort: SortFilters) => void; | ||
}; | ||
}; | ||
|
||
export const FlowRunsFilters = ({ | ||
search, | ||
sort, | ||
stateFilter, | ||
}: FlowRunsFiltersProps) => { | ||
return ( | ||
<div className="flex items-center gap-2"> | ||
<div className="flex items-center gap-2 pr-2 border-r-2"> | ||
<div className="min-w-56"> | ||
<RunNameSearch | ||
value={search.value} | ||
onChange={(e) => search.onChange(e.target.value)} | ||
placeholder="Search by run name" | ||
/> | ||
</div> | ||
<div className="min-w-56"> | ||
<StateFilter | ||
selectedFilters={stateFilter.value} | ||
onSelectFilter={stateFilter.onSelect} | ||
/> | ||
</div> | ||
</div> | ||
<SortFilter value={sort.value} onSelect={sort.onSelect} /> | ||
</div> | ||
); | ||
}; |
Empty file.
20 changes: 20 additions & 0 deletions
20
ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-filters/run-name-search.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Icon } from "@/components/ui/icons"; | ||
import { Input, type InputProps } from "@/components/ui/input"; | ||
|
||
export const RunNameSearch = (props: InputProps) => { | ||
return ( | ||
<div className="relative"> | ||
<Input | ||
aria-label="search by run name" | ||
placeholder="Search by run name" | ||
className="pl-10" | ||
{...props} | ||
/> | ||
<Icon | ||
id="Search" | ||
className="absolute left-3 top-2.5 text-muted-foreground" | ||
size={18} | ||
/> | ||
</div> | ||
); | ||
}; |
7 changes: 7 additions & 0 deletions
7
ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-filters/sort-filter.constants.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export const SORT_FILTERS = [ | ||
"START_TIME_ASC", | ||
"START_TIME_DESC", | ||
"NAME_ASC", | ||
"NAME_DESC", | ||
] as const; | ||
export type SortFilters = (typeof SORT_FILTERS)[number]; |
Oops, something went wrong.