Skip to content

Commit

Permalink
Fix #35946: Visible DAG RUN doesn't point to the same dag run id (#38365
Browse files Browse the repository at this point in the history
)

As stated by @nivdror, displaying a DAG RUN date different from
the dag run id may cause confusion to users. I fixed this by
changing the default displayed date to the Interval Start Date
instead of Interval End Date.

Co-authored-by: Tzu-ping Chung <[email protected]>
(cherry picked from commit 4dce745)
  • Loading branch information
lotrias17 authored and ephraimbuddy committed Jun 5, 2024
1 parent e96a16f commit 83e8e74
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions airflow/www/static/js/dag/details/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ interface Props {

const Header = ({ mapIndex }: Props) => {
const {
data: { dagRuns, groups, ordering },
data: { dagRuns, groups },
} = useGridData();

const {
Expand All @@ -68,7 +68,7 @@ const Header = ({ mapIndex }: Props) => {
runId.includes("scheduled__") ||
runId.includes("backfill__") ||
runId.includes("dataset_triggered__") ? (
<Time dateTime={getDagRunLabel({ dagRun, ordering })} />
<Time dateTime={getDagRunLabel({ dagRun })} />
) : (
runId
);
Expand Down
4 changes: 2 additions & 2 deletions airflow/www/static/js/utils/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ describe("Test getDagRunLabel", () => {
note: "someRandomValue",
} as DagRun;

test("Defaults to dataIntervalEnd", async () => {
test("Defaults to dataIntervalStart", async () => {
const runLabel = getDagRunLabel({ dagRun });
expect(runLabel).toBe(dagRun.dataIntervalEnd);
expect(runLabel).toBe(dagRun.dataIntervalStart);
});

test("Passing an order overrides default", async () => {
Expand Down
2 changes: 1 addition & 1 deletion airflow/www/static/js/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ interface RunLabelProps {

const getDagRunLabel = ({
dagRun,
ordering = ["dataIntervalEnd", "executionDate"],
ordering = ["dataIntervalStart", "executionDate"],
}: RunLabelProps) => dagRun[ordering[0]] ?? dagRun[ordering[1]];

const getStatusBackgroundColor = (color: string, hasNote: boolean) =>
Expand Down

0 comments on commit 83e8e74

Please sign in to comment.