Skip to content

Commit

Permalink
[ui] Offer to materialize changed and missing on asset list views (#1…
Browse files Browse the repository at this point in the history
…8722)

When we revamped the data loading in the global asset graph, we limited
the “materialize changed and missing” to specific contexts (#18198).

I think that it makes sense to show this option whenever more than one
asset is in scope, whether you’re operating on an all assets in view or
on a selection. This PR reverts a bit of #18198 so it appears here:

<img width="1727" alt="image"
src="https://github.com/dagster-io/dagster/assets/1037212/5d1df552-dcd1-4d05-93d7-6d16f320637b">

Previously, we disabled this option when `scope=selection` because there
was no confirmation modal and it was confusing whether it was "changed
and missing and in your selection" or not. Now that we have a nice modal
with checkboxes for revising + confirming the subset that will
materialize, it’s no longer confusing and we should offer it in this
case.

I audited all the callsites where we use the LaunchAssetExecutionButton,
and I think the only place we don’t want to show this option is on the
individual asset view. To make sure this doesn’t get left out again, I
inverted the option from “showChangedAndMissingOption” (show option) to
“scopeAlwaysSingleAsset” (hide option) and set it in just that one
place.

## How I Tested These Changes

I verified the existing tests covering the launch button still pass, and
tested these changes manually in the graph and list view.

---------

Co-authored-by: bengotow <[email protected]>
  • Loading branch information
bengotow and bengotow authored Jan 2, 2024
1 parent fa2e2d7 commit 64a1fa7
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,6 @@ const AssetGraphExplorerWithData = ({
? {selected: selectedDefinitions}
: {all: allDefinitionsForMaterialize}
}
showChangedAndMissingOption
/>
</Box>
{filterBar}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ export const AssetNodeLineage = ({
<LaunchAssetExecutionButton
intent="none"
scope={{all: Object.values(assetGraphData.nodes).map((n) => n.definition)}}
showChangedAndMissingOption
/>
) : (
<Button icon={<Icon name="materialization" />} disabled>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import {RefetchQueriesFunction} from '@apollo/client';
import {
Box,
Button,
Checkbox,
Icon,
MenuItem,
Menu,
MenuItem,
NonIdealState,
Popover,
Tooltip,
Checkbox,
NonIdealState,
colorAccentRed,
colorBackgroundDefault,
colorTextDisabled,
colorAccentRed,
} from '@dagster-io/ui-components';
import groupBy from 'lodash/groupBy';
import * as React from 'react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ export const AssetView = ({assetKey, trace}: Props) => {
) : definition && definition.jobNames.length > 0 && upstream ? (
<LaunchAssetExecutionButton
scope={{all: [definition]}}
showChangedAndMissingOption={false}
additionalDropdownOptions={reportEvents.dropdownOptions}
/>
) : undefined}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,17 +163,17 @@ export const LaunchAssetExecutionButton = ({
preferredJobName,
additionalDropdownOptions,
intent = 'primary',
showChangedAndMissingOption,
showChangedAndMissingOption = true,
}: {
scope: AssetsInScope;
showChangedAndMissingOption?: boolean;
intent?: 'primary' | 'none';
preferredJobName?: string;
additionalDropdownOptions?: {
label: string;
icon?: JSX.Element;
onClick: () => void;
}[];
showChangedAndMissingOption?: boolean;
}) => {
const {onClick, loading, launchpadElement} = useMaterializationAction(preferredJobName);
const [isOpen, setIsOpen] = React.useState(false);
Expand Down Expand Up @@ -256,7 +256,7 @@ export const LaunchAssetExecutionButton = ({
onClick={(e) => onClick(option.assetKeys, e)}
/>
))}
{showChangedAndMissingOption && 'all' in scope ? (
{showChangedAndMissingOption ? (
<MenuItem
text="Materialize changed and missing"
icon="changes_present"
Expand Down

1 comment on commit 64a1fa7

@github-actions
Copy link

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-gx025wvju-elementl.vercel.app

Built with commit 64a1fa7.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.