-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ui] Implement new asset Automation page
- Loading branch information
1 parent
d258427
commit 710632a
Showing
41 changed files
with
818 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
.../dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/AssetAutomationRoot.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.