Skip to content

Commit

Permalink
[UI v2] feat: Adds active task runs component
Browse files Browse the repository at this point in the history
  • Loading branch information
devinvillarosa committed Jan 2, 2025
1 parent fc1ea02 commit 38b8c11
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { TaskRunConcurrencyLimitActiveTaskRuns } from "./task-run-concurrency-limit-active-task-runs";
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import type { Meta, StoryObj } from "@storybook/react";

import {
createFakeFlow,
createFakeFlowRun,
createFakeTaskRun,
routerDecorator,
} from "@/storybook/utils";

import { TaskRunConcurrencyLimitActiveTaskRuns } from "./task-run-concurrency-limit-active-task-runs";

const MOCK_DATA = [
{
flow: createFakeFlow(),
flowRun: createFakeFlowRun(),
taskRun: createFakeTaskRun(),
},
{
flow: createFakeFlow(),
flowRun: createFakeFlowRun(),
taskRun: createFakeTaskRun({ tags: ["foo", "bar", "baz"] }),
},
{
flow: createFakeFlow(),
flowRun: createFakeFlowRun(),
taskRun: createFakeTaskRun(),
},
{
taskRun: createFakeTaskRun(),
},
{
flow: createFakeFlow(),
flowRun: createFakeFlowRun(),
taskRun: createFakeTaskRun(),
},
{
taskRun: createFakeTaskRun({ tags: ["foo", "bar", "baz"] }),
},
];

const meta: Meta<typeof TaskRunConcurrencyLimitActiveTaskRuns> = {
title:
"Components/Concurrency/TaskRunConcurrencyLimits/TaskRunConcurrencyLimitActiveTaskRuns",
component: TaskRunConcurrencyLimitActiveTaskRuns,
decorators: [routerDecorator],
args: { data: MOCK_DATA },
};
export default meta;

type Story = StoryObj<typeof TaskRunConcurrencyLimitActiveTaskRuns>;

export const story: Story = {
name: "TaskRunConcurrencyLimitActiveTaskRuns",
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { components } from "@/api/prefect";
import { Typography } from "@/components/ui/typography";
import { RunCard } from "@/components/ui/run-card";

type Props = {
data: Array<{
Expand All @@ -11,9 +11,12 @@ type Props = {

export const TaskRunConcurrencyLimitActiveTaskRuns = ({ data }: Props) => {
return (
<div>
<Typography>TODO: Active Task Runs</Typography>
{JSON.stringify(data)}
</div>
<ul className="flex flex-col gap-2">
{data.map((d) => (
<li key={d.taskRun.id}>
<RunCard flow={d.flow} flowRun={d.flowRun} taskRun={d.taskRun} />
</li>
))}
</ul>
);
};

0 comments on commit 38b8c11

Please sign in to comment.