-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ui] Implement new asset Automation page #26765
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { | ||
Box, | ||
CursorHistoryControls, | ||
NonIdealState, | ||
SpinnerWithText, | ||
} from '@dagster-io/ui-components'; | ||
import {useEffect, useRef} from 'react'; | ||
|
||
import {useEvaluationsQueryResult} from './useEvaluationsQueryResult'; | ||
import {FIFTEEN_SECONDS, useQueryRefreshAtInterval} from '../../app/QueryRefresh'; | ||
import {AssetKey} from '../types'; | ||
import {EvaluationList} from './EvaluationList'; | ||
import {AssetViewDefinitionNodeFragment} from '../types/AssetView.types'; | ||
|
||
interface Props { | ||
assetKey: AssetKey; | ||
definition: AssetViewDefinitionNodeFragment | null; | ||
} | ||
|
||
export const AssetAutomationRoot = ({assetKey, definition}: Props) => { | ||
const {queryResult, evaluations, paginationProps} = useEvaluationsQueryResult({assetKey}); | ||
const {data, loading} = queryResult; | ||
|
||
const scrollRef = useRef<HTMLDivElement>(null); | ||
|
||
// When paginating, reset scroll to top. | ||
useEffect(() => { | ||
if (scrollRef.current) { | ||
scrollRef.current.scrollTo({top: 0, behavior: 'instant'}); | ||
} | ||
}, [paginationProps.cursor]); | ||
|
||
useQueryRefreshAtInterval(queryResult, FIFTEEN_SECONDS); | ||
|
||
if (loading && !data) { | ||
return ( | ||
<Box padding={64} flex={{direction: 'column', alignItems: 'center'}}> | ||
<SpinnerWithText label="Loading evaluations…" /> | ||
</Box> | ||
); | ||
} | ||
|
||
if (!definition) { | ||
return ( | ||
<Box padding={64}> | ||
<NonIdealState | ||
icon="asset" | ||
title="Asset evaluations not found" | ||
description="This asset does not have any automation evaluations." | ||
/> | ||
</Box> | ||
); | ||
} | ||
|
||
return ( | ||
<> | ||
<Box | ||
padding={{vertical: 12, horizontal: 20}} | ||
flex={{direction: 'row', justifyContent: 'flex-end'}} | ||
> | ||
<CursorHistoryControls {...paginationProps} style={{marginTop: 0}} /> | ||
</Box> | ||
<div style={{overflowY: 'auto'}} ref={scrollRef}> | ||
<EvaluationList | ||
evaluations={evaluations} | ||
assetKey={assetKey} | ||
isPartitioned={definition.partitionDefinition !== null} | ||
/> | ||
</div> | ||
</> | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import {Table} from '@dagster-io/ui-components'; | ||
import {Colors, Table} from '@dagster-io/ui-components'; | ||
|
||
import {AssetKey} from '../types'; | ||
import {EvaluationListRow} from './EvaluationListRow'; | ||
|
@@ -7,13 +7,22 @@ import {AssetConditionEvaluationRecordFragment} from './types/GetEvaluationsQuer | |
interface Props { | ||
assetKey: AssetKey; | ||
isPartitioned: boolean; | ||
assetCheckName?: string; | ||
evaluations: AssetConditionEvaluationRecordFragment[]; | ||
} | ||
|
||
export const EvaluationList = ({assetKey, isPartitioned, evaluations}: Props) => { | ||
export const EvaluationList = ({assetKey, isPartitioned, assetCheckName, evaluations}: Props) => { | ||
return ( | ||
<Table> | ||
<thead> | ||
<thead | ||
style={{ | ||
position: 'sticky', | ||
top: 0, | ||
backgroundColor: Colors.backgroundDefault(), | ||
zIndex: 1, | ||
boxShadow: `inset 0 -1px 0 ${Colors.keylineDefault()}`, | ||
}} | ||
> | ||
<tr> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sticky header while scrolling. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if we should go ahead and switch this out for a virtualized list? We have the HeaderRow for that one... With the row component this table already feels pretty close to our standard virtualized one.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It probably could be virtualized, it just seemed a bit overkill for a table with a maximum of 25-30 items. |
||
<th>Timestamp</th> | ||
<th style={{width: '240px'}}>Evaluation result</th> | ||
|
@@ -27,6 +36,7 @@ export const EvaluationList = ({assetKey, isPartitioned, evaluations}: Props) => | |
key={evaluation.id} | ||
evaluation={evaluation} | ||
assetKey={assetKey} | ||
assetCheckName={assetCheckName} | ||
isPartitioned={isPartitioned} | ||
/> | ||
); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this so that the parent component can determine when the cursor has changed, and reset scroll position accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh I think I did this on the new RunsFeed page as well, but a bit differently. That version watches for the state to transition to loading and then back to ready (RunsFeedTable.tsx::84), but maybe that should be switched to this more direct approach too..
I think one issue I was running in to was that it looks a bit janky to scroll to the top before the data has loaded -- watching the state transition was the best way I could find to scroll only once the new data was available.
I wonder if we could have
useCursorPaginatedQuery
return the cursor that matches the data it loaded, and not the cursor that is is is loading, so that it behaves that way?