Skip to content

Commit 0518eba

Browse files
bbovenziephraimbuddy
authored andcommitted
Fix grid header rendering (#38720)
(cherry picked from commit 5337066)
1 parent 0961e42 commit 0518eba

File tree

2 files changed

+14
-22
lines changed

2 files changed

+14
-22
lines changed

airflow/www/static/js/dag/details/Header.tsx

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,33 +28,28 @@ import {
2828
import { getDagRunLabel, getMetaValue, getTask } from "src/utils";
2929
import useSelection from "src/dag/useSelection";
3030
import Time from "src/components/Time";
31-
import { useGridData, useTaskInstance } from "src/api";
31+
import { useGridData } from "src/api";
3232
import RunTypeIcon from "src/components/RunTypeIcon";
3333

3434
import BreadcrumbText from "./BreadcrumbText";
3535

36-
const dagId = getMetaValue("dag_id");
3736
const dagDisplayName = getMetaValue("dag_display_name");
3837

39-
const Header = () => {
38+
interface Props {
39+
mapIndex?: string | number | null;
40+
}
41+
42+
const Header = ({ mapIndex }: Props) => {
4043
const {
4144
data: { dagRuns, groups, ordering },
4245
} = useGridData();
4346

4447
const {
45-
selected: { taskId, runId, mapIndex },
48+
selected: { taskId, runId },
4649
onSelect,
4750
clearSelection,
4851
} = useSelection();
4952

50-
const { data: taskInstance } = useTaskInstance({
51-
dagId,
52-
dagRunId: runId || "",
53-
taskId: taskId || "",
54-
mapIndex,
55-
enabled: mapIndex !== undefined,
56-
});
57-
5853
const dagRun = dagRuns.find((r) => r.runId === runId);
5954

6055
const group = getTask({ taskId, task: groups });
@@ -88,11 +83,7 @@ const Header = () => {
8883
);
8984
}
9085

91-
const lastIndex = taskId ? taskId.lastIndexOf(".") : null;
92-
const taskName =
93-
taskInstance?.taskDisplayName && lastIndex
94-
? taskInstance?.taskDisplayName.substring(lastIndex + 1)
95-
: taskId;
86+
const taskName = group?.label || group?.id || "";
9687

9788
const isDagDetails = !runId && !taskId;
9889
const isRunDetails = !!(runId && !taskId);
@@ -141,10 +132,7 @@ const Header = () => {
141132
<BreadcrumbLink
142133
_hover={isMappedTaskDetails ? { cursor: "default" } : undefined}
143134
>
144-
<BreadcrumbText
145-
label="Map Index"
146-
value={taskInstance?.renderedMapIndex || mapIndex}
147-
/>
135+
<BreadcrumbText label="Map Index" value={mapIndex} />
148136
</BreadcrumbLink>
149137
</BreadcrumbItem>
150138
)}

airflow/www/static/js/dag/details/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,11 @@ const Details = ({
247247
flexWrap="wrap"
248248
ml={6}
249249
>
250-
<Header />
250+
<Header
251+
mapIndex={
252+
mappedTaskInstance?.renderedMapIndex || mappedTaskInstance?.mapIndex
253+
}
254+
/>
251255
<Flex flexWrap="wrap">
252256
{runId && !taskId && (
253257
<>

0 commit comments

Comments
 (0)