Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide task duration if we don't have a start_date #47633

Merged
merged 2 commits into from
Mar 11, 2025
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
4 changes: 3 additions & 1 deletion airflow/ui/src/pages/MappedTaskInstance/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ export const Header = ({
...entries,
{ label: "Start", value: <Time datetime={taskInstance.start_date} /> },
{ label: "End", value: <Time datetime={taskInstance.end_date} /> },
{ label: "Duration", value: `${getDuration(taskInstance.start_date, taskInstance.end_date)}s` },
...(Boolean(taskInstance.start_date)
? [{ label: "Duration", value: `${getDuration(taskInstance.start_date, taskInstance.end_date)}s` }]
: []),
];

return (
Expand Down
8 changes: 3 additions & 5 deletions airflow/ui/src/pages/TaskInstance/Details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,9 @@ export const Details = () => {
<Table.Row>
<Table.Cell>Duration</Table.Cell>
<Table.Cell>
{
// eslint-disable-next-line unicorn/no-null
getDuration(tryInstance?.start_date ?? null, tryInstance?.end_date ?? null)
}
s
{Boolean(tryInstance?.start_date) // eslint-disable-next-line unicorn/no-null
? `${getDuration(tryInstance?.start_date ?? null, tryInstance?.end_date ?? null)}s`
: ""}
</Table.Cell>
</Table.Row>
<Table.Row>
Expand Down
4 changes: 3 additions & 1 deletion airflow/ui/src/pages/TaskInstance/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ export const Header = ({
...(taskInstance.try_number > 1 ? [{ label: "Try Number", value: taskInstance.try_number }] : []),
{ label: "Start", value: <Time datetime={taskInstance.start_date} /> },
{ label: "End", value: <Time datetime={taskInstance.end_date} /> },
{ label: "Duration", value: `${getDuration(taskInstance.start_date, taskInstance.end_date)}s` },
...(Boolean(taskInstance.start_date)
? [{ label: "Duration", value: `${getDuration(taskInstance.start_date, taskInstance.end_date)}s` }]
: []),
{
label: "DAG Version",
value:
Expand Down
3 changes: 2 additions & 1 deletion airflow/ui/src/pages/TaskInstances/TaskInstances.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ const taskInstanceColumns = (
header: "Operator",
},
{
cell: ({ row: { original } }) => `${getDuration(original.start_date, original.end_date)}s`,
cell: ({ row: { original } }) =>
Boolean(original.start_date) ? `${getDuration(original.start_date, original.end_date)}s` : "",
header: "Duration",
},
{
Expand Down