Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion ui-v2/biome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/2.1.2/schema.json",
"$schema": "https://biomejs.dev/schemas/2.3.8/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
Expand Down Expand Up @@ -50,5 +50,11 @@
"formatter": {
"quoteStyle": "double"
}
},
"css": {
"parser": {
"cssModules": true,
"tailwindDirectives": true
}
}
}
132 changes: 120 additions & 12 deletions ui-v2/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ui-v2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"zod": "^3.25.76"
},
"devDependencies": {
"@biomejs/biome": "^2.1.2",
"@biomejs/biome": "^2.3.8",
"@eslint/js": "^9.38.0",
"@storybook/addon-docs": "^9.1.3",
"@storybook/addon-themes": "^9.1.3",
Expand Down
4 changes: 3 additions & 1 deletion ui-v2/src/components/flow-runs/flow-run-tags-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ export function FlowRunTagsSelect({
const suggestions = useMemo(() => {
const all = new Set<string>();
(data?.results ?? []).forEach((fr) => {
(fr.tags ?? []).forEach((t) => all.add(t));
(fr.tags ?? []).forEach((t) => {
all.add(t);
});
});
return Array.from(all).sort((a, b) => a.localeCompare(b));
}, [data?.results]);
Expand Down
2 changes: 1 addition & 1 deletion ui-v2/src/components/schemas/schema-form-input-any-of.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function SchemaFormInputAnyOf({
const values = useRef(new Map<number, unknown>());

function onSelectedIndexChange(newSelectedIndexValue: string) {
const newSelectedIndex = Number.parseInt(newSelectedIndexValue);
const newSelectedIndex = Number.parseInt(newSelectedIndexValue, 10);

if (Number.isNaN(newSelectedIndex)) {
throw new Error(`Invalid index: ${newSelectedIndexValue}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ function RelativeView({
const [quantitySearch = ""] = search.match(/\d+/) ?? [];
const [unitSearch = ""] = search.match(/[a-zA-Z]+/) ?? [];
const [directionSearch = ""] = search.match(/[+-]+/) ?? [];
const parsed = Number.parseInt(quantitySearch);
const parsed = Number.parseInt(quantitySearch, 10);
const quantity = Number.isNaN(parsed) ? 1 : parsed;

const spans: Option[] = [
Expand Down
5 changes: 3 additions & 2 deletions ui-v2/src/components/ui/date-time-picker/date-time-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ export function DateTimePicker({
const newDate = new Date(date);
if (type === "hour") {
newDate.setHours(
(Number.parseInt(value) % 12) + (newDate.getHours() >= 12 ? 12 : 0),
(Number.parseInt(value, 10) % 12) +
(newDate.getHours() >= 12 ? 12 : 0),
);
} else if (type === "minute") {
newDate.setMinutes(Number.parseInt(value));
newDate.setMinutes(Number.parseInt(value, 10));
} else if (type === "ampm") {
const currentHours = newDate.getHours();
newDate.setHours(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,26 +69,23 @@ describe("FlowRunActivityBarChart", () => {
["PAUSED", "fill-gray-500"],
["RUNNING", "fill-blue-700"],
["CRASHED", "fill-orange-600"],
])(
"renders the bars with expected colors for %s",
(stateType, expectedClass) => {
const enrichedFlowRun = {
...mockFlowRun,
state_type: stateType,
};
render(
<FlowRunActivityBarChart
{...defaultProps}
// @ts-expect-error - Type error from test data not matching schema
enrichedFlowRuns={[enrichedFlowRun]}
/>,
);
const bars = screen.getAllByRole("graphics-symbol");
expect(
within(bars[0]).getByTestId("bar-rect-test-flow-run-1"),
).toHaveClass(expectedClass);
},
);
])("renders the bars with expected colors for %s", (stateType, expectedClass) => {
const enrichedFlowRun = {
...mockFlowRun,
state_type: stateType,
};
render(
<FlowRunActivityBarChart
{...defaultProps}
// @ts-expect-error - Type error from test data not matching schema
enrichedFlowRuns={[enrichedFlowRun]}
/>,
);
const bars = screen.getAllByRole("graphics-symbol");
expect(within(bars[0]).getByTestId("bar-rect-test-flow-run-1")).toHaveClass(
expectedClass,
);
});

it("applies custom bar width when provided", () => {
const customBarWidth = 12;
Expand Down
44 changes: 22 additions & 22 deletions ui-v2/src/components/ui/state-badge/state-badge.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,29 +57,29 @@ describe("StateBadge", () => {
},
];

test.each(states)(
"renders correct icon and classes for $type state",
({ type, name }) => {
render(<StateBadge type={type} name={name} />);
test.each(states)("renders correct icon and classes for $type state", ({
type,
name,
}) => {
render(<StateBadge type={type} name={name} />);

// Check if state name is rendered
expect(screen.getByText(name)).toBeInTheDocument();
// Check if state name is rendered
expect(screen.getByText(name)).toBeInTheDocument();

// Check if correct classes are applied based on the CLASSES mapping
const badge = screen.getByText(name).closest("span");
const expectedClasses = {
COMPLETED: "bg-green-50 text-green-600 hover:bg-green-50",
FAILED: "bg-red-50 text-red-600 hover:bg-red-50",
RUNNING: "bg-blue-100 text-blue-700 hover:bg-blue-100",
CANCELLED: "bg-gray-300 text-gray-800 hover:bg-gray-300",
CANCELLING: "bg-gray-300 text-gray-800 hover:bg-gray-300",
CRASHED: "bg-orange-50 text-orange-600 hover:bg-orange-50",
PAUSED: "bg-gray-300 text-gray-800 hover:bg-gray-300",
PENDING: "bg-gray-300 text-gray-800 hover:bg-gray-300",
SCHEDULED: "bg-yellow-100 text-yellow-700 hover:bg-yellow-100",
}[type];
// Check if correct classes are applied based on the CLASSES mapping
const badge = screen.getByText(name).closest("span");
const expectedClasses = {
COMPLETED: "bg-green-50 text-green-600 hover:bg-green-50",
FAILED: "bg-red-50 text-red-600 hover:bg-red-50",
RUNNING: "bg-blue-100 text-blue-700 hover:bg-blue-100",
CANCELLED: "bg-gray-300 text-gray-800 hover:bg-gray-300",
CANCELLING: "bg-gray-300 text-gray-800 hover:bg-gray-300",
CRASHED: "bg-orange-50 text-orange-600 hover:bg-orange-50",
PAUSED: "bg-gray-300 text-gray-800 hover:bg-gray-300",
PENDING: "bg-gray-300 text-gray-800 hover:bg-gray-300",
SCHEDULED: "bg-yellow-100 text-yellow-700 hover:bg-yellow-100",
}[type];

expect(badge).toHaveClass(...expectedClasses.split(" "));
},
);
expect(badge).toHaveClass(...expectedClasses.split(" "));
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export const PriorityEditorDialog = ({
onChange={(e) =>
setPriorities((prev) => ({
...prev,
[queue.id]: Number.parseInt(e.target.value) || 0,
[queue.id]: Number.parseInt(e.target.value, 10) || 0,
}))
}
className="w-20"
Expand Down
4 changes: 2 additions & 2 deletions ui-v2/src/index.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@import "tailwindcss";

@plugin 'tailwindcss-animate';
@plugin '@tailwindcss/typography';
@plugin "tailwindcss-animate";
@plugin "@tailwindcss/typography";

@custom-variant dark (&:is(.dark *));

Expand Down