@@ -3,12 +3,15 @@ import { Divider } from 'antd';
3
3
import React , { useEffect , useState } from 'react' ;
4
4
import styled from 'styled-components' ;
5
5
import { ErrorRounded } from '@mui/icons-material' ;
6
- import { isUnhealthy } from '@src/app/shared/health/healthUtils' ;
6
+ import { isDeprecated , isUnhealthy } from '@src/app/shared/health/healthUtils' ;
7
+ import { useEntityRegistry } from '@src/app/useEntityRegistry' ;
8
+ import { GenericEntityProperties } from '@src/app/entity/shared/types' ;
7
9
import { useSearchAcrossLineageQuery } from '../../../../../graphql/search.generated' ;
8
- import { Dataset , EntityType , FilterOperator , LineageDirection } from '../../../../../types.generated' ;
10
+ import { FilterOperator , LineageDirection } from '../../../../../types.generated' ;
9
11
import {
10
12
HAS_ACTIVE_INCIDENTS_FILTER_NAME ,
11
13
HAS_FAILING_ASSERTIONS_FILTER_NAME ,
14
+ IS_DEPRECATED_FILTER_NAME ,
12
15
} from '../../../../search/utils/constants' ;
13
16
import { useAppConfig } from '../../../../useAppConfig' ;
14
17
import { useEntityData } from '../../../../entity/shared/EntityContext' ;
@@ -49,10 +52,11 @@ const Container = styled.div`
49
52
50
53
export default function UpstreamHealth ( ) {
51
54
const { entityData } = useEntityData ( ) ;
55
+ const entityRegistry = useEntityRegistry ( ) ;
52
56
53
57
const [ isOpen , setIsOpen ] = useState ( false ) ;
54
- const [ directUpstreamEntities , setDirectUpstreamEntities ] = useState < Dataset [ ] > ( [ ] ) ;
55
- const [ indirectUpstreamEntities , setIndirectUpstreamEntities ] = useState < Dataset [ ] > ( [ ] ) ;
58
+ const [ directUpstreamEntities , setDirectUpstreamEntities ] = useState < GenericEntityProperties [ ] > ( [ ] ) ;
59
+ const [ indirectUpstreamEntities , setIndirectUpstreamEntities ] = useState < GenericEntityProperties [ ] > ( [ ] ) ;
56
60
57
61
const [ directUpstreamsDataStart , setDirectUpstreamsDataStart ] = useState ( 0 ) ;
58
62
const [ indirectUpstreamsDataStart , setIndirectUpstreamsDataStart ] = useState ( 0 ) ;
@@ -71,10 +75,13 @@ export default function UpstreamHealth() {
71
75
skip : ! lineageEnabled ,
72
76
variables : {
73
77
input : {
78
+ searchFlags : {
79
+ skipCache : true ,
80
+ } ,
74
81
urn,
75
82
query : '*' ,
76
83
startTimeMillis,
77
- types : [ EntityType . Dataset ] ,
84
+ types : [ ] ,
78
85
count : DATASET_COUNT ,
79
86
start,
80
87
direction : LineageDirection . Upstream ,
@@ -107,6 +114,20 @@ export default function UpstreamHealth() {
107
114
} ,
108
115
] ,
109
116
} ,
117
+ {
118
+ and : [
119
+ {
120
+ field : 'degree' ,
121
+ condition : FilterOperator . Equal ,
122
+ values : degree ,
123
+ } ,
124
+ {
125
+ field : IS_DEPRECATED_FILTER_NAME ,
126
+ condition : FilterOperator . Equal ,
127
+ values : [ 'true' ] ,
128
+ } ,
129
+ ] ,
130
+ } ,
110
131
] ,
111
132
} ,
112
133
includeAssertions : false ,
@@ -126,27 +147,33 @@ export default function UpstreamHealth() {
126
147
useEffect ( ( ) => {
127
148
if ( directUpstreamData ?. searchAcrossLineage ?. searchResults ?. length && ! directUpstreamEntities . length ) {
128
149
setDirectUpstreamEntities (
129
- directUpstreamData . searchAcrossLineage . searchResults . map ( ( result ) => result . entity as Dataset ) ,
150
+ directUpstreamData . searchAcrossLineage . searchResults
151
+ . map ( ( result ) => entityRegistry . getGenericEntityProperties ( result . entity . type , result . entity ) )
152
+ . filter ( ( e ) => e !== null ) as GenericEntityProperties [ ] ,
130
153
) ;
131
154
setDirectUpstreamsDataTotal ( directUpstreamData . searchAcrossLineage . total ) ;
132
155
}
133
156
} , [
134
157
directUpstreamData ?. searchAcrossLineage ?. searchResults ,
135
158
directUpstreamEntities . length ,
136
159
directUpstreamData ?. searchAcrossLineage ?. total ,
160
+ entityRegistry ,
137
161
] ) ;
138
162
139
163
useEffect ( ( ) => {
140
164
if ( indirectUpstreamData ?. searchAcrossLineage ?. searchResults ?. length && ! indirectUpstreamEntities . length ) {
141
165
setIndirectUpstreamEntities (
142
- indirectUpstreamData . searchAcrossLineage . searchResults . map ( ( result ) => result . entity as Dataset ) ,
166
+ indirectUpstreamData . searchAcrossLineage . searchResults
167
+ . map ( ( result ) => entityRegistry . getGenericEntityProperties ( result . entity . type , result . entity ) )
168
+ . filter ( ( e ) => e !== null ) as GenericEntityProperties [ ] ,
143
169
) ;
144
170
setIndirectUpstreamsDataTotal ( indirectUpstreamData . searchAcrossLineage . total ) ;
145
171
}
146
172
} , [
147
173
indirectUpstreamData ?. searchAcrossLineage ?. searchResults ,
148
174
indirectUpstreamEntities . length ,
149
175
indirectUpstreamData ?. searchAcrossLineage ?. total ,
176
+ entityRegistry ,
150
177
] ) ;
151
178
152
179
function loadMoreDirectUpstreamData ( ) {
@@ -160,7 +187,9 @@ export default function UpstreamHealth() {
160
187
if ( result . data . searchAcrossLineage ?. searchResults ) {
161
188
setDirectUpstreamEntities ( [
162
189
...directUpstreamEntities ,
163
- ...result . data . searchAcrossLineage . searchResults . map ( ( r ) => r . entity as Dataset ) ,
190
+ ...( result . data . searchAcrossLineage . searchResults
191
+ . map ( ( r ) => entityRegistry . getGenericEntityProperties ( r . entity . type , r . entity ) )
192
+ . filter ( ( e ) => e !== null ) as GenericEntityProperties [ ] ) ,
164
193
] ) ;
165
194
}
166
195
} ) ;
@@ -178,15 +207,21 @@ export default function UpstreamHealth() {
178
207
if ( result . data . searchAcrossLineage ?. searchResults ) {
179
208
setIndirectUpstreamEntities ( [
180
209
...indirectUpstreamEntities ,
181
- ...result . data . searchAcrossLineage . searchResults . map ( ( r ) => r . entity as Dataset ) ,
210
+ ...( result . data . searchAcrossLineage . searchResults
211
+ . map ( ( r ) => entityRegistry . getGenericEntityProperties ( r . entity . type , r . entity ) )
212
+ . filter ( ( e ) => e !== null ) as GenericEntityProperties [ ] ) ,
182
213
] ) ;
183
214
}
184
215
} ) ;
185
216
setIndirectUpstreamsDataStart ( newStart ) ;
186
217
}
187
218
188
- const unhealthyDirectUpstreams = directUpstreamEntities . filter ( ( e ) => e . health && isUnhealthy ( e . health ) ) ;
189
- const unhealthyIndirectUpstreams = indirectUpstreamEntities . filter ( ( e ) => e . health && isUnhealthy ( e . health ) ) ;
219
+ const unhealthyDirectUpstreams = directUpstreamEntities . filter (
220
+ ( e ) => ( e . health && isUnhealthy ( e . health ) ) || isDeprecated ( e ) ,
221
+ ) ;
222
+ const unhealthyIndirectUpstreams = indirectUpstreamEntities . filter (
223
+ ( e ) => ( e . health && isUnhealthy ( e . health ) ) || isDeprecated ( e ) ,
224
+ ) ;
190
225
191
226
const hasUnhealthyUpstreams = unhealthyDirectUpstreams . length || unhealthyIndirectUpstreams . length ;
192
227
@@ -216,6 +251,8 @@ export default function UpstreamHealth() {
216
251
indirectUpstreamsDataTotal - ( indirectUpstreamsDataStart + DATASET_COUNT ) ,
217
252
0 ,
218
253
) }
254
+ showDeprecatedIcon
255
+ showHealthIcon
219
256
/>
220
257
) }
221
258
</ CTAWrapper >
0 commit comments