Skip to content
Merged
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
2 changes: 1 addition & 1 deletion airflow-core/src/airflow/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^7.1.1",
"eslint-plugin-react-refresh": "^0.5.3",
"eslint-plugin-unicorn": "^64.0.0",
"eslint-plugin-unicorn": "^72.0.0",
"globals": "^15.15.0",
"happy-dom": "^20.10.6",
"jsonc-eslint-parser": "^2.4.2",
Expand Down
230 changes: 182 additions & 48 deletions airflow-core/src/airflow/ui/pnpm-lock.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ const createChakraProps = (bundle: AnserJsonEntry) => {
case "underline":
props.textDecoration = "underline";
break;
// eslint-disable-next-line unicorn/no-useless-switch-case

case null:
default:
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ describe("MarkdownModal", () => {

it("toggles between the textarea and a rendered preview while editing", () => {
// The modal is controlled, so drive mdContent from a stateful wrapper.
// eslint-disable-next-line unicorn/consistent-function-scoping -- test-local wrapper, keep beside the test
const ControlledModal = () => {
const [value, setValue] = useState("");

Expand Down
9 changes: 4 additions & 5 deletions airflow-core/src/airflow/ui/src/hooks/usePluginTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,10 @@ export const usePluginTabs = (destination: string): Array<TabPlugin> => {

return externalViews.map((view) => {
// Choose icon based on theme - prefer dark mode icon if available and in dark mode
let iconSrc = view.icon;

if (colorMode === "dark" && view.icon_dark_mode !== undefined && view.icon_dark_mode !== null) {
iconSrc = view.icon_dark_mode;
}
const iconSrc =
colorMode === "dark" && view.icon_dark_mode !== undefined && view.icon_dark_mode !== null
? view.icon_dark_mode
: view.icon;

const icon =
iconSrc !== undefined && iconSrc !== null ? (
Expand Down
2 changes: 1 addition & 1 deletion airflow-core/src/airflow/ui/src/mocks/handlers/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const ti = {
id: "019518f4-1adb-7223-a917-45fe08b78947",
version_number: 1,
},
duration: 0.203_977,
duration: 0.203977,
end_date: "2025-02-18T12:19:56.467235Z",
executor: null,
executor_config: "{}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ vi.mock("src/components/ui", async (importOriginal) => {
// Must stay inside the factory: vitest hoists vi.mock above module scope, so an outer-scope
// component cannot be referenced here.

// eslint-disable-next-line unicorn/consistent-function-scoping -- must stay in the vi.mock factory (hoisting)
const DialogPart = ({ children }: { readonly children?: ReactNode }) => <div>{children}</div>;

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const RenderedTemplatesContent = () => {
if (value !== null && value !== undefined) {
const renderedValue =
typeof value === "string"
? value.split("\\n").join("\n").replaceAll(/\\$/gmu, "")
? value.replaceAll("\\n", "\n").replaceAll(/\\$/gmu, "")
: JSON.stringify(value, null, 2);
const language = detectLanguage(renderedValue);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,20 @@ export const TaskInstance = () => {
const taskCount = Object.entries(taskInstanceSummary?.child_states ?? {})
.map(([_state, count]) => count)
.reduce((sum, val) => sum + val, 0);
let newTabs = tabs;

if (taskInstance && taskInstance.map_index > -1) {
newTabs = [
...tabs.slice(0, 1),
{
icon: <MdOutlineTask />,
label: translate("tabs.mappedTaskInstances_other", {
count: Number(taskCount),
}),
value: "task_instances",
},
...tabs.slice(1),
];
}
const newTabs =
taskInstance && taskInstance.map_index > -1
? [
...tabs.slice(0, 1),
{
icon: <MdOutlineTask />,
label: translate("tabs.mappedTaskInstances_other", {
count: Number(taskCount),
}),
value: "task_instances",
},
...tabs.slice(1),
]
: tabs;

const { tabs: requiredActionTabs } = useRequiredActionTabs({ dagId, dagRunId: runId, taskId }, newTabs, {
autoRedirect: true,
Expand Down
14 changes: 7 additions & 7 deletions airflow-core/src/airflow/ui/src/utils/datetimeUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe("getDuration & formatDuration", () => {
expect(getDuration(null, null)).toBe(undefined);
expect(getDuration(undefined, undefined)).toBe(undefined);
expect(getDuration(null, "2024-03-14T10:00:10.000Z")).toBe(undefined);
expect(renderDuration(0.000_01)).toBe(undefined);
expect(renderDuration(0.00001)).toBe(undefined);
});

it("falls back to current time when endDate is null (running task)", () => {
Expand All @@ -91,12 +91,12 @@ describe("getDuration & formatDuration", () => {
});

it("handles floating point milliseconds", () => {
expect(renderDuration(dayjs.duration(10.000_499_738, "seconds"))).toBe("00:00:10");
expect(renderDuration(10.000_499_738)).toBe("00:00:10");
expect(renderDuration(dayjs.duration(10.000_500, "seconds"))).toBe("00:00:10.001");
expect(renderDuration(10.000_500)).toBe("00:00:10.001");
expect(renderDuration(dayjs.duration(10.838_999_738, "seconds"))).toBe("00:00:10.839");
expect(renderDuration(10.838_999_738)).toBe("00:00:10.839");
expect(renderDuration(dayjs.duration(10.000499738, "seconds"))).toBe("00:00:10");
expect(renderDuration(10.000499738)).toBe("00:00:10");
expect(renderDuration(dayjs.duration(10.0005, "seconds"))).toBe("00:00:10.001");
expect(renderDuration(10.0005)).toBe("00:00:10.001");
expect(renderDuration(dayjs.duration(10.838999738, "seconds"))).toBe("00:00:10.839");
expect(renderDuration(10.838999738)).toBe("00:00:10.839");
});
});

Expand Down
Loading