Skip to content

Commit

Permalink
[ui] Offer to materialize changed and missing in more contexts
Browse files Browse the repository at this point in the history
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.

Previously, we disabled this option when “scope=selection” because there was no confirmation modal and it was confusing whether it would use 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.

I audited all the callsites where we use the LaunchAssetExecutionButton, and the only places 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.
  • Loading branch information
bengotow committed Dec 14, 2023
1 parent f7b9556 commit a346ff5
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 @@ -729,7 +729,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 @@ -265,6 +265,7 @@ export const AssetView = ({assetKey}: Props) => {
) : definition && definition.jobNames.length > 0 && upstream ? (
<LaunchAssetExecutionButton
scope={{all: [definition]}}
scopeAlwaysSingleAsset
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,
scopeAlwaysSingleAsset,
}: {
scope: AssetsInScope;
scopeAlwaysSingleAsset?: 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 ? (
{!scopeAlwaysSingleAsset ? (
<MenuItem
text="Materialize changed and missing"
icon="changes_present"
Expand Down

0 comments on commit a346ff5

Please sign in to comment.