Skip to content

Commit

Permalink
refactor fake data in workflows-lib stories
Browse files Browse the repository at this point in the history
  • Loading branch information
iamvigneshwars committed Sep 12, 2024
1 parent 83e21e0 commit b8c41e9
Show file tree
Hide file tree
Showing 6 changed files with 161 additions and 451 deletions.
58 changes: 2 additions & 56 deletions frontend/workflows-lib/stories/TasksDynamic.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,63 +1,9 @@
import type { Meta, StoryObj, StoryFn } from "@storybook/react";
import { fakeTasksA } from "./common";
import TasksDynamic from "../lib/components/workflow/TasksDynamic";
import { ResizableBox } from "react-resizable";
import "react-resizable/css/styles.css";

const fakeTasks = [
{
workflow: "1",
name: "task-1",
status: "completed",
},
{
depends: "task-1",
workflow: "1",
name: "task-2 DKJFOKJLSKDMFO",
status: "completed",
},
{
depends: "task-1",
workflow: "1",
name: "task-3",
status: "running",
},
{
workflow: "1",
name: "task-4 ERFBAK3KJ34",
status: "running",
},
{
depends: "task-3",
workflow: "1",
name: "task-6 KNMNE9",
status: "running",
},
{
depends: "task-3",
workflow: "1",
name: "task-7 KLDJF034 DFJSOID 039402KDJO",
status: "running",
},
{
depends: "task-3",
workflow: "1",
name: "task-8",
status: "pending",
},
{
depends: "task-6 KNMNE9",
workflow: "1",
name: "task-9",
status: "pending",
},
{
depends: "task-9",
workflow: "1",
name: "task-10",
status: "pending",
},
];

const ResizableDecorator = (Story: StoryFn) => (
<ResizableBox
width={1200}
Expand Down Expand Up @@ -88,6 +34,6 @@ export default meta;

export const Dynamic: Story = {
args: {
tasks: fakeTasks,
tasks: fakeTasksA,
},
};
75 changes: 2 additions & 73 deletions frontend/workflows-lib/stories/TasksFlow.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,78 +1,7 @@
import type { Meta, StoryObj } from "@storybook/react";
import { fakeTasksA } from "./common";
import TaskFlow from "../lib/components/workflow/TasksFlow";

const fakeTasks = [
{
workflow: "1",
name: "task-1",
status: "completed",
},
{
depends: "task-1",
workflow: "1",
name: "task-2 DKJFOKJLSKDMFO",
status: "completed",
},
{
depends: "task-1",
workflow: "1",
name: "task-3",
status: "running",
},
{
workflow: "1",
name: "task-4 ERFBAK3KJ34",
status: "running",
},
{
workflow: "1",
name: "task-5 EOI909D",
status: "completed",
},
{
depends: "task-3",
workflow: "1",
name: "task-6 KNMNE9",
status: "running",
},
{
depends: "task-3",
workflow: "1",
name: "task-7 KLDJF034 DFJSOID 039402KDJO",
status: "running",
},
{
depends: "task-3",
workflow: "1",
name: "task-8",
status: "pending",
},
{
depends: "task-6 KNMNE9",
workflow: "1",
name: "task-9",
status: "pending",
},
{
depends: "task-9",
workflow: "1",
name: "task-10",
status: "pending",
},
{
depends: "task-10",
workflow: "1",
name: "task-11",
status: "pending",
},
{
depends: "task-5 EOI909D",
workflow: "1",
name: "task-12",
status: "completed",
},
];

const meta: Meta<typeof TaskFlow> = {
title: "Tasks",
component: TaskFlow,
Expand All @@ -83,6 +12,6 @@ type Story = StoryObj<typeof TaskFlow>;
export default meta;
export const Graph: Story = {
args: {
tasks: fakeTasks,
tasks: fakeTasksA,
},
};
75 changes: 2 additions & 73 deletions frontend/workflows-lib/stories/TasksTable.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,78 +1,7 @@
import type { Meta, StoryObj } from "@storybook/react";
import { fakeTasksA } from "./common";
import TasksTable from "../lib/components/workflow/TasksTable";

const fakeTasks = [
{
workflow: "1",
name: "task-1",
status: "completed",
},
{
depends: "task-1",
workflow: "1",
name: "task-2 DKJFOKJLSKDMFO",
status: "completed",
},
{
depends: "task-1",
workflow: "1",
name: "task-3",
status: "running",
},
{
workflow: "1",
name: "task-4 ERFBAK3KJ34",
status: "running",
},
{
workflow: "1",
name: "task-5 EOI909D",
status: "completed",
},
{
depends: "task-3",
workflow: "1",
name: "task-6 KNMNE9",
status: "running",
},
{
depends: "task-3",
workflow: "1",
name: "task-7 KLDJF034 DFJSOID 039402KDJODKLFJLDJFLKSDJFLKJSD",
status: "running",
},
{
depends: "task-3",
workflow: "1",
name: "task-8",
status: "pending",
},
{
depends: "task-6 KNMNE9",
workflow: "1",
name: "task-9",
status: "pending",
},
{
depends: "task-9",
workflow: "1",
name: "task-10",
status: "pending",
},
{
depends: "task-10",
workflow: "1",
name: "task-11",
status: "pending",
},
{
depends: "task-5 EOI909D",
workflow: "1",
name: "task-12",
status: "completed",
},
];

const meta: Meta<typeof TasksTable> = {
title: "Tasks",
component: TasksTable,
Expand All @@ -83,6 +12,6 @@ type Story = StoryObj<typeof TasksTable>;
export default meta;
export const Table: Story = {
args: {
tasks: fakeTasks,
tasks: fakeTasksA,
},
};
82 changes: 2 additions & 80 deletions frontend/workflows-lib/stories/WorkflowAccordion.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,84 +1,6 @@
import type { Meta, StoryObj } from "@storybook/react";
import { fakeWorkflowA } from "./common";
import WorkflowAccordion from "../lib/components/workflow/WorkflowAccordian";
import { WorkflowStatus } from "../lib/types";

const fakeTasks = [
{
workflow: "1",
name: "task-1",
status: "completed",
},
{
depends: "task-1",
workflow: "1",
name: "task-2 DKJFOKJLSKDMFO",
status: "completed",
},
{
depends: "task-1",
workflow: "1",
name: "task-3",
status: "running",
},
{
workflow: "1",
name: "task-4 ERFBAK3KJ34",
status: "running",
},
{
workflow: "1",
name: "task-5 EOI909D",
status: "completed",
},
{
depends: "task-3",
workflow: "1",
name: "task-6 KNMNE9",
status: "running",
},
{
depends: "task-3",
workflow: "1",
name: "task-7 KLDJF034 DFJSOID 039402KDJODKLFJLDJFLKSDJFLKJSD",
status: "running",
},
{
depends: "task-3",
workflow: "1",
name: "task-8",
status: "pending",
},
{
depends: "task-6 KNMNE9",
workflow: "1",
name: "task-9",
status: "pending",
},
{
depends: "task-9",
workflow: "1",
name: "task-10",
status: "pending",
},
{
depends: "task-10",
workflow: "1",
name: "task-11",
status: "pending",
},
{
depends: "task-5 EOI909D",
workflow: "1",
name: "task-12",
status: "completed",
},
];

const fakeWorkflow = {
name: "Workflow 1",
status: "Failed" as WorkflowStatus,
tasks: fakeTasks,
};

const meta: Meta<typeof WorkflowAccordion> = {
title: "Workflow",
Expand All @@ -90,6 +12,6 @@ type Story = StoryObj<typeof WorkflowAccordion>;
export default meta;
export const Accordion: Story = {
args: {
workflow: fakeWorkflow,
workflow: fakeWorkflowA,
},
};
Loading

0 comments on commit b8c41e9

Please sign in to comment.