@@ -28,33 +28,28 @@ import {
28
28
import { getDagRunLabel , getMetaValue , getTask } from "src/utils" ;
29
29
import useSelection from "src/dag/useSelection" ;
30
30
import Time from "src/components/Time" ;
31
- import { useGridData , useTaskInstance } from "src/api" ;
31
+ import { useGridData } from "src/api" ;
32
32
import RunTypeIcon from "src/components/RunTypeIcon" ;
33
33
34
34
import BreadcrumbText from "./BreadcrumbText" ;
35
35
36
- const dagId = getMetaValue ( "dag_id" ) ;
37
36
const dagDisplayName = getMetaValue ( "dag_display_name" ) ;
38
37
39
- const Header = ( ) => {
38
+ interface Props {
39
+ mapIndex ?: string | number | null ;
40
+ }
41
+
42
+ const Header = ( { mapIndex } : Props ) => {
40
43
const {
41
44
data : { dagRuns, groups, ordering } ,
42
45
} = useGridData ( ) ;
43
46
44
47
const {
45
- selected : { taskId, runId, mapIndex } ,
48
+ selected : { taskId, runId } ,
46
49
onSelect,
47
50
clearSelection,
48
51
} = useSelection ( ) ;
49
52
50
- const { data : taskInstance } = useTaskInstance ( {
51
- dagId,
52
- dagRunId : runId || "" ,
53
- taskId : taskId || "" ,
54
- mapIndex,
55
- enabled : mapIndex !== undefined ,
56
- } ) ;
57
-
58
53
const dagRun = dagRuns . find ( ( r ) => r . runId === runId ) ;
59
54
60
55
const group = getTask ( { taskId, task : groups } ) ;
@@ -88,11 +83,7 @@ const Header = () => {
88
83
) ;
89
84
}
90
85
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 || "" ;
96
87
97
88
const isDagDetails = ! runId && ! taskId ;
98
89
const isRunDetails = ! ! ( runId && ! taskId ) ;
@@ -141,10 +132,7 @@ const Header = () => {
141
132
< BreadcrumbLink
142
133
_hover = { isMappedTaskDetails ? { cursor : "default" } : undefined }
143
134
>
144
- < BreadcrumbText
145
- label = "Map Index"
146
- value = { taskInstance ?. renderedMapIndex || mapIndex }
147
- />
135
+ < BreadcrumbText label = "Map Index" value = { mapIndex } />
148
136
</ BreadcrumbLink >
149
137
</ BreadcrumbItem >
150
138
) }
0 commit comments