1
- import {
2
- Box ,
3
- ButtonGroup ,
4
- Colors ,
5
- ErrorBoundary ,
6
- NonIdealState ,
7
- Spinner ,
8
- Subheading ,
9
- } from '@dagster-io/ui-components' ;
1
+ import { Box , Colors , ErrorBoundary , NonIdealState , Spinner } from '@dagster-io/ui-components' ;
10
2
import * as React from 'react' ;
11
3
import { useMemo } from 'react' ;
12
4
13
5
import { AssetEventDetail , AssetEventDetailEmpty } from './AssetEventDetail' ;
14
6
import { AssetEventList } from './AssetEventList' ;
15
- import { AssetPartitionDetail , AssetPartitionDetailEmpty } from './AssetPartitionDetail' ;
16
7
import { CurrentRunsBanner } from './CurrentRunsBanner' ;
17
8
import { FailedRunSinceMaterializationBanner } from './FailedRunSinceMaterializationBanner' ;
18
9
import { LaunchAssetExecutionButton } from './LaunchAssetExecutionButton' ;
@@ -22,7 +13,6 @@ import {AssetViewDefinitionNodeFragment} from './types/AssetView.types';
22
13
import { useAssetDefinition } from './useAssetDefinition' ;
23
14
import { useAssetEventsFilters } from './useAssetEventsFilters' ;
24
15
import { usePaginatedAssetEvents } from './usePaginatedAssetEvents' ;
25
- import { getXAxisForParams } from './useRecentAssetEvents' ;
26
16
import { LiveDataForNode , stepKeyForAsset } from '../asset-graph/Utils' ;
27
17
import { MaterializationHistoryEventTypeSelector , RepositorySelector } from '../graphql/types' ;
28
18
@@ -50,18 +40,6 @@ export const AssetEvents = ({
50
40
liveData,
51
41
dataRefreshHint,
52
42
} : Props ) => {
53
- /**
54
- * We have a separate "Asset > Partitions" tab, but that is only available for SDAs with
55
- * pre-defined partitions. For non-SDAs, this Events page still displays a "Time | Partition"
56
- * picker and this xAxis can still be `partitions`!
57
- *
58
- * The partitions behavior in this case isn't ideal because the UI only "sees" partition names
59
- * in the events it has fetched. Users should upgrade to SDAs for a better experience.
60
- *
61
- * To test this easily, unload / break your code location so your SDA becomes a non-SDA :-)
62
- */
63
- const xAxis = getXAxisForParams ( params , { defaultToPartitions : false } ) ;
64
-
65
43
const { filterButton, activeFiltersJsx, filterState} = useAssetEventsFilters ( {
66
44
assetKey,
67
45
assetNode,
@@ -80,8 +58,10 @@ export const AssetEvents = ({
80
58
return combinedParams ;
81
59
} , [ params , filterState . dateRange ] ) ;
82
60
83
- const { materializations, observations, loadedPartitionKeys, fetchMore, fetchLatest, loading} =
84
- usePaginatedAssetEvents ( assetKey , combinedParams ) ;
61
+ const { materializations, observations, fetchMore, fetchLatest, loading} = usePaginatedAssetEvents (
62
+ assetKey ,
63
+ params ,
64
+ ) ;
85
65
86
66
React . useEffect ( ( ) => {
87
67
fetchLatest ( ) ;
@@ -92,21 +72,19 @@ export const AssetEvents = ({
92
72
combinedParams . after ,
93
73
combinedParams . before ,
94
74
combinedParams . status ,
95
- combinedParams . partitions ,
96
75
] ) ;
97
76
98
77
const grouped = useGroupedEvents (
99
- xAxis ,
78
+ 'time' ,
100
79
filterState . type ?. includes ( 'Materialization' ) ? materializations : [ ] ,
101
80
filterState . type ?. includes ( 'Observation' ) ? observations : [ ] ,
102
- loadedPartitionKeys ,
81
+ [ ] ,
103
82
) ;
104
83
105
84
const onSetFocused = ( group : AssetEventGroup | undefined ) => {
106
- const updates : Partial < AssetViewParams > =
107
- xAxis === 'time'
108
- ? { time : group ?. timestamp !== params . time ? group ?. timestamp || '' : '' }
109
- : { partition : group ?. partition !== params . partition ? group ?. partition || '' : '' } ;
85
+ const updates : Partial < AssetViewParams > = {
86
+ time : group ?. timestamp !== params . time ? group ?. timestamp || '' : '' ,
87
+ } ;
110
88
setParams ( { ...params , ...updates } ) ;
111
89
} ;
112
90
@@ -119,16 +97,6 @@ export const AssetEvents = ({
119
97
: false ,
120
98
) || grouped [ 0 ] ;
121
99
122
- // Note: This page still has a LOT of logic for displaying events by partition but it's only enabled
123
- // in one case -- when the asset is an old-school, non-software-defined asset with partition keys
124
- // on it's materializations but no defined partition set.
125
- //
126
- const assetHasUndefinedPartitions =
127
- ! assetNode ?. partitionDefinition && grouped . some ( ( g ) => g . partition ) ;
128
- const assetHasLineage = materializations . some (
129
- ( m ) => 'assetLineage' in m && m . assetLineage . length > 0 ,
130
- ) ;
131
-
132
100
const onKeyDown = ( e : React . KeyboardEvent < any > ) => {
133
101
const shift = { ArrowDown : 1 , ArrowUp : - 1 } [ e . key ] ;
134
102
if ( ! shift || ! focused || e . isDefaultPrevented ( ) ) {
@@ -148,8 +116,7 @@ export const AssetEvents = ({
148
116
const hasFilter =
149
117
combinedParams . status !== MaterializationHistoryEventTypeSelector . ALL ||
150
118
combinedParams . before !== undefined ||
151
- combinedParams . after !== undefined ||
152
- combinedParams . partitions !== undefined ;
119
+ combinedParams . after !== undefined ;
153
120
if ( ! loading && ! materializations . length && ! observations . length && ! hasFilter ) {
154
121
return (
155
122
< Box padding = { { horizontal : 24 , vertical : 64 } } >
@@ -185,33 +152,6 @@ export const AssetEvents = ({
185
152
{ activeFiltersJsx }
186
153
</ Box >
187
154
) : null }
188
- { assetHasUndefinedPartitions && (
189
- < Box
190
- flex = { { justifyContent : 'space-between' , alignItems : 'center' } }
191
- border = "bottom"
192
- padding = { { vertical : 16 , horizontal : 24 } }
193
- style = { { marginBottom : - 1 } }
194
- >
195
- < Subheading > Asset Events</ Subheading >
196
- < div style = { { margin : '-6px 0 ' } } >
197
- < ButtonGroup
198
- activeItems = { new Set ( [ xAxis ] ) }
199
- buttons = { [
200
- { id : 'partition' , label : 'By partition' } ,
201
- { id : 'time' , label : 'By timestamp' } ,
202
- ] }
203
- onClick = { ( id : string ) =>
204
- setParams (
205
- id === 'time'
206
- ? { ...params , partition : undefined , time : focused ?. timestamp || '' }
207
- : { ...params , partition : focused ?. partition || '' , time : undefined } ,
208
- )
209
- }
210
- />
211
- </ div >
212
- </ Box >
213
- ) }
214
-
215
155
{ assetNode && ! assetNode . partitionDefinition && (
216
156
< >
217
157
< FailedRunSinceMaterializationBanner
@@ -258,7 +198,7 @@ export const AssetEvents = ({
258
198
</ Box >
259
199
) : (
260
200
< AssetEventList
261
- xAxis = { xAxis }
201
+ xAxis = "time"
262
202
groups = { grouped }
263
203
focused = { focused }
264
204
setFocused = { onSetFocused }
@@ -274,20 +214,7 @@ export const AssetEvents = ({
274
214
border = "left"
275
215
>
276
216
< ErrorBoundary region = "event" resetErrorOnChange = { [ focused ] } >
277
- { xAxis === 'partition' ? (
278
- focused ? (
279
- < AssetPartitionDetail
280
- group = { focused }
281
- hasLineage = { assetHasLineage }
282
- assetKey = { assetKey }
283
- stepKey = { assetNode ? stepKeyForAsset ( assetNode ) : undefined }
284
- latestRunForPartition = { null }
285
- changedReasons = { assetNode ?. changedReasons }
286
- />
287
- ) : (
288
- < AssetPartitionDetailEmpty />
289
- )
290
- ) : focused ?. latest ? (
217
+ { focused ?. latest ? (
291
218
< AssetEventDetail assetKey = { assetKey } event = { focused . latest } />
292
219
) : (
293
220
< AssetEventDetailEmpty />
0 commit comments