Changeset View
Changeset View
Standalone View
Standalone View
js_modules/dagit/packages/core/src/runs/RunActionButtons.tsx
Show First 20 Lines • Show All 258 Lines • ▼ Show 20 Lines | return { | ||||
tooltip: `"${run.pipeline.name}" could not be found.`, | tooltip: `"${run.pipeline.name}" could not be found.`, | ||||
disabled: true, | disabled: true, | ||||
}; | }; | ||||
} | } | ||||
if (repoMatch) { | if (repoMatch) { | ||||
const {type: matchType} = repoMatch; | const {type: matchType} = repoMatch; | ||||
// The run matches the active snapshot ID for the pipeline, so we're safe to execute the run. | // The run matches the repository and active snapshot ID for the pipeline. This is the best | ||||
if (matchType === 'snapshot') { | // we can do, so consider it safe to run as-is. | ||||
if (matchType === 'origin-and-snapshot') { | |||||
return null; | return null; | ||||
} | } | ||||
// A repo was found, but only because the pipeline name matched. The run might not work | // Beyond this point, we're just trying our best. Warn the user that behavior might not be what | ||||
// as expected. | // they expect. | ||||
if (matchType === 'origin-only') { | |||||
// Only the repo is a match. | |||||
return { | |||||
icon: IconNames.WARNING_SIGN, | |||||
tooltip: `The pipeline "${run.pipeline.name}" may be a different version from the original pipeline run.`, | |||||
disabled: false, | |||||
}; | |||||
} | |||||
if (matchType === 'snapshot-only') { | |||||
// Only the snapshot ID matched, but not the repo. | |||||
return { | |||||
icon: IconNames.WARNING_SIGN, | |||||
tooltip: ( | |||||
yuhan: nit: is it possible to get the original repo name? would be great if we could include that in… | |||||
<Group direction="column" spacing={4}> | |||||
<div>{`The pipeline "${run.pipeline.name}" is not in the same repository as the original pipeline run.`}</div> | |||||
{run.repositoryOrigin ? ( | |||||
<div> | |||||
Original repository:{' '} | |||||
<strong> | |||||
{run.repositoryOrigin.repositoryName}@ | |||||
{run.repositoryOrigin.repositoryLocationName} | |||||
</strong> | |||||
</div> | |||||
) : null} | |||||
</Group> | |||||
), | |||||
disabled: false, | |||||
}; | |||||
} | |||||
// Only the pipeline name matched. This could be from any repo in the workspace. | |||||
return { | return { | ||||
icon: IconNames.WARNING_SIGN, | icon: IconNames.WARNING_SIGN, | ||||
tooltip: | tooltip: `The pipeline "${run.pipeline.name}" may be a different version from the original pipeline run.`, | ||||
`The pipeline "${run.pipeline.name}" in the current repository is` + | |||||
` a different version than the original pipeline run.`, | |||||
disabled: false, | disabled: false, | ||||
}; | }; | ||||
} | } | ||||
// We could not find a repo that contained this pipeline. Inform the user that they should | // We could not find a repo that contained this pipeline. Inform the user that they should | ||||
// load the missing repository. | // load the missing repository. | ||||
const repoForRun = run.repositoryOrigin?.repositoryName; | const repoForRun = run.repositoryOrigin?.repositoryName; | ||||
const repoLocationForRun = run.repositoryOrigin?.repositoryLocationName; | const repoLocationForRun = run.repositoryOrigin?.repositoryLocationName; | ||||
Show All 29 Lines |
nit: is it possible to get the original repo name? would be great if we could include that in the warning msg, so users could figure out why easier with the info.