Skip to content

Commit cce2c6c

Browse files
committed
[pac] frontend
1 parent 6d485e6 commit cce2c6c

25 files changed

Lines changed: 1410 additions & 12 deletions

js_modules/dagster-ui/packages/ui-core/client.json

Lines changed: 6 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js_modules/dagster-ui/packages/ui-core/src/assets/asset-checks/AssetCheckDetailDialog.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export const ASSET_CHECK_EXECUTION_FRAGMENT = gql`
9090
metadataEntries {
9191
...MetadataEntryFragment
9292
}
93+
partition
9394
}
9495
}
9596
${METADATA_ENTRY_FRAGMENT}

js_modules/dagster-ui/packages/ui-core/src/assets/asset-checks/AssetCheckExecutionList.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ type Execution = AssetCheckDetailsQuery['assetCheckExecutions'][0];
2222
export const AssetCheckExecutionList = ({
2323
executions,
2424
paginationProps,
25+
hasPartitions = false,
2526
}: {
2627
executions: Execution[];
2728
paginationProps: CursorPaginationProps;
29+
hasPartitions?: boolean;
2830
}) => {
2931
if (!executions) {
3032
return (
@@ -43,6 +45,7 @@ export const AssetCheckExecutionList = ({
4345
<th style={{width: '160px'}}>Evaluation result</th>
4446
<th style={{width: '200px'}}>Timestamp</th>
4547
<th style={{width: '200px'}}>Target materialization</th>
48+
{hasPartitions && <th style={{width: '150px'}}>Partition</th>}
4649
<th>
4750
<Box flex={{gap: 4}}>
4851
Description
@@ -95,6 +98,11 @@ export const AssetCheckExecutionList = ({
9598
' - '
9699
)}
97100
</td>
101+
{hasPartitions && (
102+
<td>
103+
{execution.evaluation?.partition ? execution.evaluation.partition : ' - '}
104+
</td>
105+
)}
98106
<td>
99107
{execution.evaluation?.description ? (
100108
<Description fontSize="14px" description={execution.evaluation.description} />
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
import {
2+
Box,
3+
Button,
4+
Colors,
5+
Dialog,
6+
DialogFooter,
7+
Icon,
8+
Mono,
9+
Table,
10+
} from '@dagster-io/ui-components';
11+
import * as React from 'react';
12+
import {Link} from 'react-router-dom';
13+
import styled from 'styled-components';
14+
15+
import {assetCheckExecutionStatusIcon, assetCheckExecutionStatusText} from './util';
16+
import {Timestamp} from '../../app/time/Timestamp';
17+
import {useQueryPersistedState} from '../../hooks/useQueryPersistedState';
18+
import {titleForRun} from '../../runs/RunUtils';
19+
20+
interface AssetCheckExecutionForDisplay {
21+
id: string;
22+
runId: string;
23+
status: string;
24+
timestamp: number;
25+
evaluation: {
26+
partition: string | null;
27+
} | null;
28+
}
29+
30+
interface AssetCheckHistoricalEventsButtonProps {
31+
executions: AssetCheckExecutionForDisplay[];
32+
partitionKey?: string;
33+
children?: React.ReactNode;
34+
disabled?: boolean;
35+
}
36+
37+
export const AssetCheckHistoricalEventsButton = ({
38+
executions,
39+
partitionKey,
40+
children,
41+
disabled,
42+
}: AssetCheckHistoricalEventsButtonProps) => {
43+
const [_open, setOpen] = useQueryPersistedState<boolean>({
44+
queryKey: 'showAllCheckEvents',
45+
decode: (qs) => typeof qs.showAllCheckEvents === 'string' && qs.showAllCheckEvents === 'true',
46+
encode: (b) => ({showAllCheckEvents: b ? 'true' : undefined}),
47+
});
48+
49+
const title = partitionKey
50+
? `Historical check executions for ${partitionKey}`
51+
: `Historical check executions`;
52+
53+
const hasPartitions = executions.some((e) => e.evaluation?.partition);
54+
55+
const open = _open && !disabled;
56+
57+
return (
58+
<>
59+
<Button disabled={disabled} onClick={() => setOpen(true)}>
60+
{children || `View all historical executions (${executions.length})`}
61+
</Button>
62+
<Dialog
63+
isOpen={open}
64+
canEscapeKeyClose
65+
canOutsideClickClose
66+
onClose={() => setOpen(false)}
67+
style={{width: '80%', minWidth: '800px'}}
68+
title={title}
69+
>
70+
{open && (
71+
<Box padding={{bottom: 8}}>
72+
<Table>
73+
<thead>
74+
<tr>
75+
{hasPartitions && <th style={{minWidth: 100}}>Partition</th>}
76+
<th style={{minWidth: 150}}>Timestamp</th>
77+
<th style={{minWidth: 120}}>Status</th>
78+
<th style={{width: 100}}>Run</th>
79+
</tr>
80+
</thead>
81+
<tbody>
82+
{executions.map((execution) => (
83+
<HoverableRow key={execution.id}>
84+
{hasPartitions && (
85+
<td style={{whiteSpace: 'nowrap', paddingLeft: 8}}>
86+
{execution.evaluation?.partition || (
87+
<span style={{color: Colors.textLight()}}>None</span>
88+
)}
89+
</td>
90+
)}
91+
<td>
92+
<Timestamp timestamp={{ms: Number(execution.timestamp)}} />
93+
</td>
94+
<td>
95+
<Box flex={{gap: 8, alignItems: 'center'}}>
96+
<Icon
97+
name={assetCheckExecutionStatusIcon(execution.status as any)}
98+
size={16}
99+
color={Colors.textLight()}
100+
/>
101+
{assetCheckExecutionStatusText(execution.status as any)}
102+
</Box>
103+
</td>
104+
<td>
105+
<Link to={`/runs/${execution.runId}?timestamp=${execution.timestamp}`}>
106+
<Mono>{titleForRun({id: execution.runId})}</Mono>
107+
</Link>
108+
</td>
109+
</HoverableRow>
110+
))}
111+
</tbody>
112+
</Table>
113+
</Box>
114+
)}
115+
<DialogFooter>
116+
<Button intent="primary" onClick={() => setOpen(false)}>
117+
OK
118+
</Button>
119+
</DialogFooter>
120+
</Dialog>
121+
</>
122+
);
123+
};
124+
125+
const HoverableRow = styled.tr`
126+
&:hover {
127+
background: ${Colors.backgroundLightHover()};
128+
}
129+
`;

js_modules/dagster-ui/packages/ui-core/src/assets/asset-checks/AssetCheckOverview.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,18 @@ export const AssetCheckOverview = ({
136136
</Link>
137137
</Box>
138138
) : null}
139+
{lastExecution ? (
140+
<Box flex={{direction: 'column', gap: 8}}>
141+
<Subtitle2>Partition</Subtitle2>
142+
{lastExecution.evaluation?.partition ? (
143+
<div style={{fontFamily: FontFamily.monospace, fontSize: 12}}>
144+
{lastExecution.evaluation.partition}
145+
</div>
146+
) : (
147+
<>&mdash;</>
148+
)}
149+
</Box>
150+
) : null}
139151
</Box>
140152
{lastExecution?.evaluation?.metadataEntries.length ? (
141153
<Box flex={{direction: 'column', gap: 8}}>

0 commit comments

Comments
 (0)