@@ -2,21 +2,75 @@ import {Box, ExternalAnchorButton, NonIdealState, SpinnerWithText} from '@dagste
2
2
3
3
import { AssetMaterializationGraphs } from './AssetMaterializationGraphs' ;
4
4
import { useGroupedEvents } from './groupByPartition' ;
5
- import { AssetKey , AssetViewParams } from './types' ;
6
- import { useRecentAssetEvents } from './useRecentAssetEvents' ;
5
+ import { AssetKey } from './types' ;
6
+ import {
7
+ useLatestAssetPartitionMaterializations ,
8
+ useRecentAssetEvents ,
9
+ } from './useRecentAssetEvents' ;
7
10
8
- interface Props {
9
- assetKey ?: AssetKey ;
10
- params : AssetViewParams ;
11
- assetHasDefinedPartitions : boolean ;
12
- }
11
+ export const AssetTimeMetadataPlots = ( {
12
+ assetKey,
13
+ limit,
14
+ asSidebarSection,
15
+ columnCount,
16
+ } : {
17
+ assetKey : AssetKey | undefined ;
18
+ limit : number ;
19
+ asSidebarSection ?: boolean ;
20
+ columnCount ?: number ;
21
+ } ) => {
22
+ const { materializations, observations, loading} = useRecentAssetEvents ( assetKey , limit ) ;
23
+ const grouped = useGroupedEvents ( 'time' , materializations , observations , undefined ) ;
13
24
14
- export const AssetEventMetadataPlots = ( props : Props ) => {
15
- const { assetKey, params, assetHasDefinedPartitions} = props ;
16
- const { materializations, observations, loadedPartitionKeys, loading, xAxis} =
17
- useRecentAssetEvents ( assetKey , params , { assetHasDefinedPartitions} ) ;
25
+ if ( loading ) {
26
+ return (
27
+ < Box padding = { { vertical : 24 } } flex = { { direction : 'row' , justifyContent : 'center' } } >
28
+ < SpinnerWithText label = "Loading plots…" />
29
+ </ Box >
30
+ ) ;
31
+ }
32
+
33
+ return (
34
+ < AssetMaterializationGraphs
35
+ xAxis = "time"
36
+ groups = { grouped }
37
+ asSidebarSection = { asSidebarSection }
38
+ columnCount = { columnCount }
39
+ emptyState = {
40
+ < Box padding = { { horizontal : 24 , vertical : 64 } } >
41
+ < NonIdealState
42
+ shrinkable
43
+ icon = "asset_plot"
44
+ title = "Asset plots are automatically generated by metadata"
45
+ description = "Include numeric metadata entries in your materializations and observations to see data graphed by time or partition."
46
+ action = {
47
+ < ExternalAnchorButton href = "https://docs.dagster.io/concepts/metadata-tags/asset-metadata" >
48
+ View documentation
49
+ </ ExternalAnchorButton >
50
+ }
51
+ />
52
+ </ Box >
53
+ }
54
+ />
55
+ ) ;
56
+ } ;
18
57
19
- const grouped = useGroupedEvents ( xAxis , materializations , observations , loadedPartitionKeys ) ;
58
+ export const AssetPartitionMetadataPlots = ( {
59
+ assetKey,
60
+ limit,
61
+ asSidebarSection,
62
+ columnCount,
63
+ } : {
64
+ assetKey : AssetKey | undefined ;
65
+ limit : number ;
66
+ asSidebarSection ?: boolean ;
67
+ columnCount ?: number ;
68
+ } ) => {
69
+ const { materializations, partitionKeys, loading} = useLatestAssetPartitionMaterializations (
70
+ assetKey ,
71
+ limit ,
72
+ ) ;
73
+ const grouped = useGroupedEvents ( 'partition' , materializations , [ ] , partitionKeys ) ;
20
74
21
75
if ( loading ) {
22
76
return (
@@ -28,8 +82,10 @@ export const AssetEventMetadataPlots = (props: Props) => {
28
82
29
83
return (
30
84
< AssetMaterializationGraphs
31
- xAxis = { xAxis }
85
+ xAxis = "partition"
32
86
groups = { grouped }
87
+ asSidebarSection = { asSidebarSection }
88
+ columnCount = { columnCount }
33
89
emptyState = {
34
90
< Box padding = { { horizontal : 24 , vertical : 64 } } >
35
91
< NonIdealState
0 commit comments