Skip to content

Commit

Permalink
hold shift to force asset config modal (#8668)
Browse files Browse the repository at this point in the history
  • Loading branch information
smackesey committed Jun 29, 2022
1 parent 7a34e49 commit 9842ba8
Showing 1 changed file with 20 additions and 16 deletions.
Expand Up @@ -85,7 +85,7 @@ export const LaunchAssetExecutionButton: React.FC<{
);
}

const onClick = async () => {
const onClick = async (e: React.MouseEvent<any>) => {
if (state.type === 'loading') {
return;
}
Expand All @@ -96,7 +96,8 @@ export const LaunchAssetExecutionButton: React.FC<{
variables: {assetKeys: assetKeys.map(({path}) => ({path}))},
});
const assets = result.data.assetNodes;
const next = stateForLaunchingAssets(assets, preferredJobName);
const forceLaunchpad = e.shiftKey;
const next = stateForLaunchingAssets(assets, forceLaunchpad, preferredJobName);

if (next.type === 'error') {
showCustomAlert({
Expand All @@ -114,19 +115,21 @@ export const LaunchAssetExecutionButton: React.FC<{

return (
<>
<Button
intent={intent}
onClick={onClick}
icon={
state.type === 'loading' ? (
<Spinner purpose="body-text" />
) : (
<Icon name="materialization" />
)
}
>
{label}
</Button>
<Tooltip content="Shift+click to add configuration">
<Button
intent={intent}
onClick={onClick}
icon={
state.type === 'loading' ? (
<Spinner purpose="body-text" />
) : (
<Icon name="materialization" />
)
}
>
{label}
</Button>
</Tooltip>
{state.type === 'launchpad' && (
<AssetLaunchpad
assetJobName={state.jobName}
Expand All @@ -152,6 +155,7 @@ export const LaunchAssetExecutionButton: React.FC<{

function stateForLaunchingAssets(
assets: LaunchAssetExecutionAssetNodeFragment[],
forceLaunchpad: boolean,
preferredJobName?: string,
): LaunchAssetsState {
if (assets.some(isSourceAsset)) {
Expand Down Expand Up @@ -206,7 +210,7 @@ function stateForLaunchingAssets(

// Ok! Assertions met, how do we launch this run

if (anyAssetsHaveConfig) {
if (anyAssetsHaveConfig || forceLaunchpad) {
const assetOpNames = assets.flatMap((a) => a.opNames || []);
return {
type: 'launchpad',
Expand Down

0 comments on commit 9842ba8

Please sign in to comment.