-
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.
Support new selection syntax in Run GanttChart. (#26632)
## Summary & Motivation Adds support for the new selection syntax in the Gantt chart. ## How I Tested These Changes Tested: 1. Retrying runs using the selection syntax to select the steps. 2. Selecting / Unselecting multiple steps by shift clicking on steps. 3. Using status and name filters. 4. Making sure the logs are filtered to the correct steps matching the selection. <img width="677" alt="Screenshot 2024-12-20 at 10 30 52 AM" src="https://github.com/user-attachments/assets/9f94cc19-bc7a-4a5f-900a-5c351a5a2677" /> <img width="625" alt="Screenshot 2024-12-20 at 10 30 46 AM" src="https://github.com/user-attachments/assets/2bb45583-52c5-4695-ac54-0b5f931fb2ae" /> <img width="1724" alt="Screenshot 2024-12-20 at 10 30 40 AM" src="https://github.com/user-attachments/assets/bd7507a7-77d4-402d-9b5b-4d3f0386445b" /> <img width="1726" alt="Screenshot 2024-12-20 at 10 30 18 AM" src="https://github.com/user-attachments/assets/bacb4060-b879-4251-bff6-f7a3e085be6a" /> <img width="1463" alt="Screenshot 2024-12-20 at 10 30 00 AM" src="https://github.com/user-attachments/assets/6a87c64f-0c0a-4543-aaac-d03218cab19c" />
- Loading branch information
Showing
10 changed files
with
233 additions
and
79 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
61 changes: 61 additions & 0 deletions
61
js_modules/dagster-ui/packages/ui-core/src/gantt/GanttChartSelectionInput.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,61 @@ | ||
import {useMemo} from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
import {RunGraphQueryItem} from './toGraphQueryItems'; | ||
import {NO_STATE} from '../run-selection/AntlrRunSelectionVisitor'; | ||
import {RunSelectionLexer} from '../run-selection/generated/RunSelectionLexer'; | ||
import {RunSelectionParser} from '../run-selection/generated/RunSelectionParser'; | ||
import {InputDiv, SelectionAutoCompleteInput} from '../selection/SelectionAutoCompleteInput'; | ||
import {createSelectionLinter} from '../selection/createSelectionLinter'; | ||
import {weakMapMemoize} from '../util/weakMapMemoize'; | ||
|
||
export const GanttChartSelectionInput = ({ | ||
items, | ||
value, | ||
onChange, | ||
}: { | ||
items: RunGraphQueryItem[]; | ||
value: string; | ||
onChange: (value: string) => void; | ||
}) => { | ||
const attributesMap = useMemo(() => { | ||
const statuses = new Set<string>(); | ||
const names = new Set<string>(); | ||
|
||
items.forEach((item) => { | ||
if (item.metadata?.state) { | ||
statuses.add(item.metadata.state); | ||
} else { | ||
statuses.add(NO_STATE); | ||
} | ||
names.add(item.name); | ||
}); | ||
return {name: Array.from(names), status: Array.from(statuses)}; | ||
}, [items]); | ||
|
||
return ( | ||
<Wrapper> | ||
<SelectionAutoCompleteInput | ||
nameBase="name" | ||
attributesMap={attributesMap} | ||
placeholder="Type a step subset" | ||
functions={FUNCTIONS} | ||
linter={getLinter()} | ||
value={value} | ||
onChange={onChange} | ||
/> | ||
</Wrapper> | ||
); | ||
}; | ||
|
||
const getLinter = weakMapMemoize(() => | ||
createSelectionLinter({Lexer: RunSelectionLexer, Parser: RunSelectionParser}), | ||
); | ||
|
||
const FUNCTIONS = ['sinks', 'roots']; | ||
|
||
const Wrapper = styled.div` | ||
${InputDiv} { | ||
width: 24vw; | ||
} | ||
`; |
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.
b96403d
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-b63ns01c7-elementl.vercel.app
Built with commit b96403d.
This pull request is being automatically deployed with vercel-action