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

Fix/pci rancher version fix sort tapc 2629 #15272

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

ppprevost
Copy link
Contributor

@ppprevost ppprevost commented Feb 3, 2025

Question Answer
Branch? develop
Bug fix? yes
New feature? no
Breaking change? yes/no
Tickets Fix #... TAPC-2629
License BSD 3-Clause
  • Try to keep pull requests small so they can be easily reviewed.
  • Commits are signed-off
  • Only FR translations have been updated
  • Branch is up-to-date with target branch
  • Lint has passed locally
  • Standalone app was ran and tested locally
  • Ticket reference is mentioned in linked commits (internal only)
  • Breaking change is mentioned in relevant commits

Description

Related

};

export const sortVersions = (versions: RancherVersion[]): RancherVersion[] => {
return [...versions].sort((a, b) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy should be handled by caller. In your specific case since there is a filter before you do not need to copy the array

@@ -26,6 +26,29 @@ export const getCurrentVersionInfo = (
return getVersionInfoByName(currentVersion, versions);
};

export const compareVersions = (v1: string, v2: string): number => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should use https://www.npmjs.com/package/semver instead

Comment on lines 64 to 66
if (sortedVersions.length === 0) {
return null;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This case is already handled line 72

return sortVersions(availableVersions)[availableVersions.length - 1];
}
return null;
}, [versions, selectedVersion]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why : selectedVersion is in this array ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a mistake, a previous dependecy i forget to delete

SimonChaumet
SimonChaumet previously approved these changes Feb 3, 2025
tibs245
tibs245 previously approved these changes Feb 4, 2025
ovh-ux-cds and others added 7 commits February 4, 2025 11:35
ref: TAPC-2629
Signed-off-by: Pierre-Philippe <[email protected]>
ref: TAPC-2629
Signed-off-by: Pierre-Philippe <[email protected]>
ref: TAPC-2629
Signed-off-by: Pierre-Philippe <[email protected]>
ref: TAPC-2629
Signed-off-by: Pierre-Philippe <[email protected]>
ref: TAPC-2629
Signed-off-by: Pierre-Philippe <[email protected]>
@ppprevost ppprevost force-pushed the fix/pci-rancher_version-fix-sort_tapc-2629 branch from dd9cd75 to 92012b8 Compare February 4, 2025 10:36
Copy link

sonarqubecloud bot commented Feb 4, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working universe-public-cloud
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants