Skip to content

Commit

Permalink
design tweaks for cursor page
Browse files Browse the repository at this point in the history
  • Loading branch information
dliu27 committed Dec 6, 2024
1 parent 540697a commit 7740246
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ import password from '../icon-svgs/password.svg';
import pause from '../icon-svgs/pause.svg';
import people from '../icon-svgs/people.svg';
import plots from '../icon-svgs/plots.svg';
import preview_tick from '../icon-svgs/preview_tick.svg';
import priority_1 from '../icon-svgs/priority_1.svg';
import priority_2 from '../icon-svgs/priority_2.svg';
import priority_3 from '../icon-svgs/priority_3.svg';
Expand Down Expand Up @@ -664,6 +665,7 @@ export const Icons = {
pause,
people,
plots,
preview_tick,
priority_1,
priority_2,
priority_3,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Box, Button, Tooltip} from '@dagster-io/ui-components';
import {Box, Button, Icon, Tooltip} from '@dagster-io/ui-components';
import {useState} from 'react';

import {SensorDryRunDialog} from './SensorDryRunDialog';
Expand Down Expand Up @@ -32,6 +32,7 @@ export const EvaluateTickButtonSensor = ({
<Button
disabled={sensorType !== SensorType.STANDARD}
onClick={() => setShowTestTickDialog(true)}
icon={<Icon name="preview_tick" />}
>
Preview tick result
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
DialogFooter,
Group,
Icon,
NonIdealState,
Spinner,
Subheading,
Tag,
Expand Down Expand Up @@ -64,8 +63,8 @@ export const SensorDryRunDialog = (props: Props) => {
isOpen={isOpen}
onClose={onClose}
style={{width: '70vw', display: 'flex'}}
icon="sensors"
title={name}
icon="preview_tick"
title={`Preview tick result for ${name}`}
>
<SensorDryRun {...props} />
</Dialog>
Expand Down Expand Up @@ -198,8 +197,8 @@ const SensorDryRun = ({repoAddress, name, currentCursor, onClose, jobName}: Prop
return (
<Box flex={{direction: 'row', gap: 8}}>
<Button onClick={onClose}>Cancel</Button>
<Button onClick={submitTest} intent="primary" data-testid={testId('evaluate')}>
Evaluate
<Button onClick={submitTest} intent="primary" data-testid={testId('continue')}>
Continue
</Button>
</Box>
);
Expand Down Expand Up @@ -376,29 +375,24 @@ const SensorDryRun = ({repoAddress, name, currentCursor, onClose, jobName}: Prop
} else {
return (
<Box flex={{direction: 'column', gap: 8}}>
<div>Cursor</div>
<div>Cursor value (optional)</div>
<TextInput
value={cursor}
onChange={(e) => setCursor(e.target.value)}
data-testid={testId('cursor-input')}
placeholder="Enter a cursor value"
/>
{currentCursor === '' || !currentCursor ? (
<Box padding={{top: 16, bottom: 32}} flex={{justifyContent: 'center'}}>
<NonIdealState
icon="no-results"
title="You're not using a cursor"
description={
<span>
Check our{' '}
<a href="https://docs.dagster.io/concepts/partitions-schedules-sensors/sensors#idempotence-and-cursors">
sensor documentation
</a>{' '}
to learn how to use cursors
</span>
}
/>
</Box>
) : null}
<div>
A cursor tracks where a sensor left off, allowing the sensor to efficiently process new
changes or events without missing anything or duplicating work. The cursor is typically
a string, and can be updated within the sensor&apos;s logic to reflect the latest state.
</div>
<div>
<a href="https://docs.dagster.io/concepts/partitions-schedules-sensors/sensors#idempotence-and-cursors">
Learn more
</a>{' '}
about cursors
</div>
</Box>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('SensorDryRunTest', () => {
render(<Test mocks={[Mocks.SensorDryRunMutationRunRequests, Mocks.PersistCursorValueMock]} />);
const cursorInput = await screen.findByTestId('cursor-input');
await userEvent.type(cursorInput, 'testing123');
await userEvent.click(screen.getByTestId('evaluate'));
await userEvent.click(screen.getByTestId('continue'));
await waitFor(() => {
expect(screen.getByText(/3\srun requests/g)).toBeVisible();
expect(screen.queryByText('Skipped')).toBe(null);
Expand All @@ -55,7 +55,7 @@ describe('SensorDryRunTest', () => {
render(<Test mocks={[Mocks.SensorDryRunMutationError]} />);
const cursorInput = await screen.findByTestId('cursor-input');
await userEvent.type(cursorInput, 'testing123');
await userEvent.click(screen.getByTestId('evaluate'));
await userEvent.click(screen.getByTestId('continue'));
await waitFor(() => {
expect(screen.getByText('Failed')).toBeVisible();
expect(screen.queryByText('Skipped')).toBe(null);
Expand All @@ -66,7 +66,7 @@ describe('SensorDryRunTest', () => {
render(<Test mocks={[Mocks.SensorDryRunMutationError]} />);
const cursorInput = await screen.findByTestId('cursor-input');
await userEvent.type(cursorInput, 'testing123');
await userEvent.click(screen.getByTestId('evaluate'));
await userEvent.click(screen.getByTestId('continue'));
await waitFor(() => {
expect(screen.getByText('Failed')).toBeVisible();
expect(screen.queryByText('Skipped')).toBe(null);
Expand All @@ -81,7 +81,7 @@ describe('SensorDryRunTest', () => {
render(<Test mocks={[Mocks.SensorDryRunMutationSkipped]} />);
const cursorInput = await screen.findByTestId('cursor-input');
await userEvent.type(cursorInput, 'testing123');
await userEvent.click(screen.getByTestId('evaluate'));
await userEvent.click(screen.getByTestId('continue'));
await waitFor(() => {
expect(screen.getByText('Skipped')).toBeVisible();
});
Expand Down

0 comments on commit 7740246

Please sign in to comment.