Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-4.18] OCPBUGS-49921: fix run time error when no completed version exists #14743

Open
wants to merge 1 commit into
base: release-4.18
Choose a base branch
from
Open
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 @@ -219,7 +219,7 @@ export const CurrentVersion: React.FC<CurrentVersionProps> = ({ cv }) => {
{lastVersion}
</span>
</div>
<ReleaseNotesLink version={getLastCompletedUpdate(cv)} />
<ReleaseNotesLink version={lastVersion} />
</>
) : (
<>{t('public~None')}</>
Expand Down Expand Up @@ -587,9 +587,8 @@ export const UpdatesGraph: React.FC<UpdatesGraphProps> = ({ cv }) => {
const availableUpdates = getSortedAvailableUpdates(cv);
const lastVersion = getLastCompletedUpdate(cv);
const newestVersion = availableUpdates[0]?.version;
const minorVersionIsNewer = newestVersion
? isMinorVersionNewer(lastVersion, newestVersion)
: false;
const minorVersionIsNewer =
lastVersion && newestVersion ? isMinorVersionNewer(lastVersion, newestVersion) : false;
const secondNewestVersion = availableUpdates[1]?.version;
const currentChannel = cv.spec.channel;
const currentPrefix = splitClusterVersionChannel(currentChannel)?.prefix;
Expand Down
7 changes: 5 additions & 2 deletions frontend/public/module/k8s/cluster-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ export const getSortedNotRecommendedUpdates = (cv: ClusterVersionKind): Conditio

export const getNewerMinorVersionUpdate = (currentVersion, availableUpdates) => {
const currentVersionParsed = semver.parse(currentVersion);
if (!currentVersionParsed) {
return;
}
return availableUpdates?.find(
// find the next minor version update, which there should never be more than one
(update) => {
Expand All @@ -101,8 +104,8 @@ export const isMinorVersionNewer = (currentVersion, otherVersion) => {
const currentVersionParsed = semver.parse(currentVersion);
const otherVersionParsed = semver.parse(otherVersion);
return semver.gt(
semver.coerce(`${otherVersionParsed.major}.${otherVersionParsed.minor}`),
semver.coerce(`${currentVersionParsed.major}.${currentVersionParsed.minor}`),
semver.coerce(`${otherVersionParsed?.major}.${otherVersionParsed?.minor}`),
semver.coerce(`${currentVersionParsed?.major}.${currentVersionParsed?.minor}`),
);
};

Expand Down