-
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.
Add new selection syntax to job op graphs (#26836)
## Summary & Motivation 1. Consolidate `flagOpSelectionSyntax` into `flagSelectionSyntax` 2. Add a selection syntax input for the op graph and use it if the feature flag is enabled ## How I Tested These Changes <img width="1202" alt="Screenshot 2025-01-04 at 12 31 34 AM" src="https://github.com/user-attachments/assets/433613ee-ff4e-4d3b-a76f-2d2093144caf" />
- Loading branch information
Showing
7 changed files
with
117 additions
and
32 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
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
53 changes: 53 additions & 0 deletions
53
js_modules/dagster-ui/packages/ui-core/src/pipelines/OpGraphSelectionInput.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,53 @@ | ||
import {useMemo} from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
import {GraphQueryItem} from '../app/GraphQueryImpl'; | ||
import {OpSelectionLexer} from '../op-selection/generated/OpSelectionLexer'; | ||
import {OpSelectionParser} from '../op-selection/generated/OpSelectionParser'; | ||
import {InputDiv, SelectionAutoCompleteInput} from '../selection/SelectionAutoCompleteInput'; | ||
import {createSelectionLinter} from '../selection/createSelectionLinter'; | ||
import {weakMapMemoize} from '../util/weakMapMemoize'; | ||
|
||
export const OpGraphSelectionInput = ({ | ||
items, | ||
value, | ||
onChange, | ||
}: { | ||
items: GraphQueryItem[]; | ||
value: string; | ||
onChange: (value: string) => void; | ||
}) => { | ||
const attributesMap = useMemo(() => { | ||
const names = new Set<string>(); | ||
items.forEach((item) => { | ||
names.add(item.name); | ||
}); | ||
return {name: Array.from(names)}; | ||
}, [items]); | ||
|
||
return ( | ||
<Wrapper> | ||
<SelectionAutoCompleteInput | ||
nameBase="name" | ||
attributesMap={attributesMap} | ||
placeholder="Type an op subset" | ||
functions={FUNCTIONS} | ||
linter={getLinter()} | ||
value={value} | ||
onChange={onChange} | ||
/> | ||
</Wrapper> | ||
); | ||
}; | ||
|
||
const getLinter = weakMapMemoize(() => | ||
createSelectionLinter({Lexer: OpSelectionLexer, Parser: OpSelectionParser}), | ||
); | ||
|
||
const FUNCTIONS = ['sinks', 'roots']; | ||
|
||
const Wrapper = styled.div` | ||
${InputDiv} { | ||
width: 24vw; | ||
} | ||
`; |
bb041f4
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-27vp8tgmm-elementl.vercel.app
Built with commit bb041f4.
This pull request is being automatically deployed with vercel-action