-
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] add filters for storage kind (#22041)
## Summary Add frontend filters for storage kind to the asset list and asset graph pages. <img width="562" alt="Screenshot 2024-05-22 at 2 14 30 PM" src="https://github.com/dagster-io/dagster/assets/10215173/4a201721-3517-4021-9243-67482722c6d9"> ## Test Plan Tested locally
- Loading branch information
Showing
4 changed files
with
121 additions
and
4 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
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
49 changes: 49 additions & 0 deletions
49
js_modules/dagster-ui/packages/ui-core/src/ui/Filters/useStorageKindFilter.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,49 @@ | ||
import {Box, Icon} from '@dagster-io/ui-components'; | ||
import {useMemo} from 'react'; | ||
|
||
import {buildDefinitionTag} from './useAssetTagFilter'; | ||
import {useStaticSetFilter} from './useStaticSetFilter'; | ||
import {DefinitionTag} from '../../graphql/types'; | ||
import {TruncatedTextWithFullTextOnHover} from '../../nav/getLeftNavItemsForOption'; | ||
|
||
const emptyArray: any[] = []; | ||
|
||
export const useStorageKindFilter = ({ | ||
allAssetStorageKindTags, | ||
storageKindTags, | ||
setStorageKindTags, | ||
}: { | ||
allAssetStorageKindTags: DefinitionTag[]; | ||
storageKindTags?: null | DefinitionTag[]; | ||
setStorageKindTags?: null | ((s: DefinitionTag[]) => void); | ||
}) => { | ||
const memoizedState = useMemo(() => storageKindTags?.map(buildDefinitionTag), [storageKindTags]); | ||
return useStaticSetFilter<DefinitionTag>({ | ||
name: 'Storage kind', | ||
icon: 'tag', | ||
allValues: useMemo( | ||
() => | ||
allAssetStorageKindTags.map((value) => ({ | ||
value, | ||
match: [value.key + ':' + value.value], | ||
})), | ||
[allAssetStorageKindTags], | ||
), | ||
menuWidth: '300px', | ||
renderLabel: ({value: tag}) => { | ||
return ( | ||
<Box flex={{direction: 'row', gap: 4, alignItems: 'center'}}> | ||
<Icon name="tag" /> | ||
<TruncatedTextWithFullTextOnHover tooltipText={tag.value} text={tag.value} /> | ||
</Box> | ||
); | ||
}, | ||
getStringValue: ({value}) => value, | ||
state: memoizedState ?? emptyArray, | ||
onStateChanged: (values) => { | ||
setStorageKindTags?.(Array.from(values)); | ||
}, | ||
matchType: 'all-of', | ||
canSelectAll: false, | ||
}); | ||
}; |
d47c5b3
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.
Deploy preview for dagit-core-storybook ready!
✅ Preview
https://dagit-core-storybook-2eqhw5dwx-elementl.vercel.app
Built with commit d47c5b3.
This pull request is being automatically deployed with vercel-action