-
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.
refactor evaluate tick button to its own component
- Loading branch information
Showing
6 changed files
with
139 additions
and
102 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
41 changes: 41 additions & 0 deletions
41
js_modules/dagster-ui/packages/ui-core/src/ticks/EvaluateTickButtonSchedule.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,41 @@ | ||
import {Box, Button} from '@dagster-io/ui-components'; | ||
import {useState} from 'react'; | ||
|
||
import {EvaluateScheduleDialog} from './EvaluateScheduleDialog'; | ||
import {RepoAddress} from '../workspace/types'; | ||
|
||
interface EvaluateTickButtonScheduleProps { | ||
name: string; | ||
repoAddress: RepoAddress; | ||
jobName: string; | ||
} | ||
|
||
export const EvaluateTickButtonSchedule = ({ | ||
name, | ||
repoAddress, | ||
jobName, | ||
}: EvaluateTickButtonScheduleProps) => { | ||
const [showTestTickDialog, setShowTestTickDialog] = useState(false); | ||
|
||
return ( | ||
<Box flex={{direction: 'row', alignItems: 'center', gap: 8}}> | ||
<Button | ||
onClick={() => { | ||
setShowTestTickDialog(true); | ||
}} | ||
> | ||
Evaluate tick | ||
</Button> | ||
<EvaluateScheduleDialog | ||
key={showTestTickDialog ? '1' : '0'} // change key to reset dialog state | ||
isOpen={showTestTickDialog} | ||
onClose={() => { | ||
setShowTestTickDialog(false); | ||
}} | ||
name={name} | ||
repoAddress={repoAddress} | ||
jobName={jobName} | ||
/> | ||
</Box> | ||
); | ||
}; |
49 changes: 49 additions & 0 deletions
49
js_modules/dagster-ui/packages/ui-core/src/ticks/EvaluateTickButtonSensor.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, Button, Tooltip} from '@dagster-io/ui-components'; | ||
import {useState} from 'react'; | ||
|
||
import {SensorDryRunDialog} from './SensorDryRunDialog'; | ||
import {SensorType} from '../graphql/types'; | ||
import {RepoAddress} from '../workspace/types'; | ||
|
||
interface EvaluateTickButtonSensorProps { | ||
cursor: string; | ||
name: string; | ||
repoAddress: RepoAddress; | ||
jobName: string; | ||
sensorType: SensorType; | ||
} | ||
|
||
export const EvaluateTickButtonSensor = ({ | ||
cursor, | ||
name, | ||
repoAddress, | ||
jobName, | ||
sensorType, | ||
}: EvaluateTickButtonSensorProps) => { | ||
const [showTestTickDialog, setShowTestTickDialog] = useState(false); | ||
|
||
return ( | ||
<Box flex={{direction: 'row', alignItems: 'center', gap: 8}}> | ||
<Tooltip | ||
canShow={sensorType !== SensorType.STANDARD} | ||
content="Testing not available for this sensor type" | ||
placement="top-end" | ||
> | ||
<Button | ||
disabled={sensorType !== SensorType.STANDARD} | ||
onClick={() => setShowTestTickDialog(true)} | ||
> | ||
Evaluate tick | ||
</Button> | ||
</Tooltip> | ||
<SensorDryRunDialog | ||
isOpen={showTestTickDialog} | ||
onClose={() => setShowTestTickDialog(false)} | ||
currentCursor={cursor} | ||
name={name} | ||
repoAddress={repoAddress} | ||
jobName={jobName} | ||
/> | ||
</Box> | ||
); | ||
}; |