Skip to content

Commit

Permalink
Show repo selector in unloadable schedules/sensors instead of repo lo…
Browse files Browse the repository at this point in the history
…cation metadata (#7444)

Summary:
When you change a repo name and there's now an unloadable schedule, we let you see information about it in the Schedules page.

This logic used to be a lot more finnicky before phil's migration last week, so it was useful to show you all the various bits of metadata that might have changed and made it unloadable (e.g. the module name, the python executable, that kind of thing).

Now, after phil's migration, the only thing that will make a schedule unloadable is changing the repo name or the schedule name. So let's show that instead in the metadata. Also, since there's only one thing, let's ditch the "show info" button and just always show it. (The visual treatment here could probably be better)

This has the nice side effect of making this "show info" button not blank in Cloud as well (where we don't actually have access to information about the schedule's origin, just the selector)
  • Loading branch information
gibsondan committed Apr 15, 2022
1 parent 2e8136d commit 1ec9318
Show file tree
Hide file tree
Showing 18 changed files with 66 additions and 313 deletions.
2 changes: 2 additions & 0 deletions js_modules/dagit/packages/core/src/graphql/schema.graphql

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import styled from 'styled-components/macro';
import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorInfo';
import {RunStatusIndicator} from '../runs/RunStatusDots';
import {titleForRun} from '../runs/RunUtils';
import {REPOSITORY_ORIGIN_FRAGMENT} from '../workspace/RepositoryInformation';

import {TICK_TAG_FRAGMENT} from './InstigationTick';
import {InstigationStateFragment} from './types/InstigationStateFragment';
Expand Down Expand Up @@ -46,10 +45,8 @@ export const INSTIGATION_STATE_FRAGMENT = gql`
name
instigationType
status
repositoryOrigin {
id
...RepositoryOriginFragment
}
repositoryName
repositoryLocationName
typeSpecificData {
... on SensorData {
lastRunKey
Expand All @@ -71,7 +68,6 @@ export const INSTIGATION_STATE_FRAGMENT = gql`
}
runningCount
}
${REPOSITORY_ORIGIN_FRAGMENT}
${PYTHON_ERROR_FRAGMENT}
${TICK_TAG_FRAGMENT}
${RUN_STATUS_FRAGMENT}
Expand Down
38 changes: 6 additions & 32 deletions js_modules/dagit/packages/core/src/instigation/Unloadable.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
import {useMutation} from '@apollo/client';
import {
Alert,
Box,
ButtonLink,
Checkbox,
Colors,
Group,
Table,
Subheading,
Tooltip,
} from '@dagster-io/ui';
import {Alert, Box, Checkbox, Colors, Group, Table, Subheading, Tooltip} from '@dagster-io/ui';
import * as React from 'react';

import {useConfirmation} from '../app/CustomConfirmationProvider';
Expand All @@ -22,7 +12,7 @@ import {StopSchedule} from '../schedules/types/StopSchedule';
import {displaySensorMutationErrors, STOP_SENSOR_MUTATION} from '../sensors/SensorMutations';
import {StopSensor} from '../sensors/types/StopSensor';
import {InstigationStatus, InstigationType} from '../types/globalTypes';
import {RepositoryOriginInformation} from '../workspace/RepositoryInformation';
import {InstigatorSelectorInformation} from '../workspace/RepositoryInformation';

import {TickTag} from './InstigationTick';
import {InstigatedRunStatus} from './InstigationUtils';
Expand Down Expand Up @@ -133,12 +123,11 @@ const UnloadableScheduleInfo = () => (
);

const SensorStateRow = ({sensorState}: {sensorState: InstigationStateFragment}) => {
const {id, selectorId, name, status, repositoryOrigin, ticks} = sensorState;
const {id, selectorId, name, status, ticks} = sensorState;

const [stopSensor, {loading: toggleOffInFlight}] = useMutation<StopSensor>(STOP_SENSOR_MUTATION, {
onCompleted: displaySensorMutationErrors,
});
const [showRepositoryOrigin, setShowRepositoryOrigin] = React.useState(false);
const confirm = useConfirmation();

const onChangeSwitch = async () => {
Expand Down Expand Up @@ -169,15 +158,8 @@ const SensorStateRow = ({sensorState}: {sensorState: InstigationStateFragment})
<td>
<Group direction="row" spacing={8} alignItems="center">
{name}
<ButtonLink
onClick={() => {
setShowRepositoryOrigin(!showRepositoryOrigin);
}}
>
show info
</ButtonLink>
</Group>
{showRepositoryOrigin && <RepositoryOriginInformation origin={repositoryOrigin} />}
<InstigatorSelectorInformation instigatorState={sensorState} />
</td>
<td>
{latestTick ? (
Expand All @@ -204,9 +186,8 @@ const ScheduleStateRow: React.FC<{
onCompleted: displayScheduleMutationErrors,
},
);
const [showRepositoryOrigin, setShowRepositoryOrigin] = React.useState(false);
const confirm = useConfirmation();
const {id, selectorId, name, ticks, status, repositoryOrigin, typeSpecificData} = scheduleState;
const {id, selectorId, name, ticks, status, typeSpecificData} = scheduleState;
const latestTick = ticks.length > 0 ? ticks[0] : null;
const cronSchedule =
typeSpecificData && typeSpecificData.__typename === 'ScheduleData'
Expand Down Expand Up @@ -238,15 +219,8 @@ const ScheduleStateRow: React.FC<{
<td>
<Group direction="row" spacing={8} alignItems="center">
<div>{name}</div>
<ButtonLink
onClick={() => {
setShowRepositoryOrigin(!showRepositoryOrigin);
}}
>
show info
</ButtonLink>
</Group>
{showRepositoryOrigin && <RepositoryOriginInformation origin={repositoryOrigin} />}
<InstigatorSelectorInformation instigatorState={scheduleState} />
</td>
<td style={{maxWidth: 150}}>
<div
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1ec9318

Please sign in to comment.