Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,22 @@ const useStyles = makeStyles<Theme, StyleProps>(theme => ({
whiteSpace: 'nowrap',
},
container: ({ height, isDark }) => ({
height,
fontSize: '0.75rem',
border: `1px solid ${theme.palette.divider}`,
borderRadius: theme.shape.borderRadius,
overflow: 'hidden',
backgroundColor: isDark ? '#1e1e1e' : '#fafafa',
'& .cm-mergeView, & .cm-mergeViewEditors': {
height: '100%',
// Per CodeMirror's MergeView docs: views are not scrollable by default —
// the .cm-mergeView itself must have a height and `overflow: auto` to
// become the scroller. Both panes are children of .cm-mergeView, so they
// scroll together as one unit. CM's baseTheme forces inner .cm-scroller
// to height:auto + overflow:visible when nested in a .cm-mergeView, so
// we don't override those.
'& .cm-mergeView': {
height,
overflow: 'auto',
},
'& .cm-editor': {
height: '100%',
backgroundColor: 'transparent',
},
'& .cm-scroller': {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ export const EnvironmentOverridesPage = ({
disabled={saving || deleting}
style={{ marginRight: 8 }}
>
View diff
View release diff
</Button>
</span>
</Tooltip>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,25 +74,29 @@ export const ComponentReleaseDiffDialog = ({
setOriginal(null);
setModified(null);

// Diff orientation: LHS shows the target env's *current* release ("before"),
// RHS shows the upstream env's incoming release ("after"). The dialog title's
// `upstreamEnv → targetEnv` arrow still reflects promotion direction, not
// LHS → RHS.
const fetches: Array<Promise<unknown>> = [];
if (upstreamReleaseName) {
if (releaseName) {
fetches.push(
api.fetchComponentRelease(entity, upstreamReleaseName).then(res => {
api.fetchComponentRelease(entity, releaseName).then(res => {
if (cancelled) return;
if (!res?.success || !res.data) {
setError(`Couldn't fetch ${upstreamEnvName}'s release manifest.`);
setError(`Couldn't fetch ${environmentName}'s release manifest.`);
return;
}
setOriginal(YAML.stringify(res.data));
}),
);
}
if (releaseName) {
if (upstreamReleaseName) {
fetches.push(
api.fetchComponentRelease(entity, releaseName).then(res => {
api.fetchComponentRelease(entity, upstreamReleaseName).then(res => {
if (cancelled) return;
if (!res?.success || !res.data) {
setError(`Couldn't fetch ${environmentName}'s release manifest.`);
setError(`Couldn't fetch ${upstreamEnvName}'s release manifest.`);
return;
}
setModified(YAML.stringify(res.data));
Expand Down Expand Up @@ -146,28 +150,28 @@ export const ComponentReleaseDiffDialog = ({
<YamlDiffViewer
original={original}
modified={modified}
originalLabel={`${upstreamEnvName} (${upstreamReleaseName})`}
modifiedLabel={`${environmentName} (${releaseName})`}
originalLabel={`${environmentName} (${releaseName})`}
modifiedLabel={`${upstreamEnvName} (${upstreamReleaseName})`}
height="60vh"
/>
)}
{previewMode === 'source-only' && original && (
{previewMode === 'source-only' && modified && (
<>
<Typography variant="body2" color="textSecondary" gutterBottom>
<strong>{environmentName}</strong> has no release yet — this is
the manifest that will be created from{' '}
<strong>{upstreamEnvName}</strong>.
</Typography>
<YamlViewer value={original} maxHeight="60vh" showLineNumbers />
<YamlViewer value={modified} maxHeight="60vh" showLineNumbers />
</>
)}
{previewMode === 'target-only' && modified && (
{previewMode === 'target-only' && original && (
<>
<Typography variant="body2" color="textSecondary" gutterBottom>
<strong>{upstreamEnvName}</strong> has no release to compare;
showing <strong>{environmentName}</strong>'s current manifest.
</Typography>
<YamlViewer value={modified} maxHeight="60vh" showLineNumbers />
<YamlViewer value={original} maxHeight="60vh" showLineNumbers />
</>
)}
</DialogContent>
Expand Down
Loading