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

feat(Helm-Chart): Groups same helm chart into single tile #5699

Merged
merged 1 commit into from Jun 19, 2020

Conversation

abhinandan13jan
Copy link
Contributor

@abhinandan13jan abhinandan13jan commented Jun 9, 2020

Fixes:

https://issues.redhat.com/browse/ODC-4085

Analysis / Root cause:

Group helm multiple chart versions together in developer catalog

Solution Description:

Altered normalizeHelm functionality to create single item for all hellm chart versions with same name

Screenshot

Screenshot from 2020-06-10 18-39-08

After change

Screenshot from 2020-06-10 18-37-52

Test

Added to catalog test suite

Browser conformation

Chrome 73

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 9, 2020
@abhinandan13jan abhinandan13jan changed the title [WIP]feat(Helm-Chart): Groups same helm chart into single tile feat(Helm-Chart): Groups same helm chart into single tile Jun 10, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 10, 2020
};
const existingChart = normalizedCharts.findIndex((hlc) => hlc.obj?.name === chartName);
if (existingChart > -1) {
if (normalizedCharts[existingChart].obj?.version < helmChart.obj.version) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rohitkrai03 Should this string comp be fine?

Copy link
Contributor

Choose a reason for hiding this comment

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

Probably better to use natural sort here for cases like 1.10.0 > 1.2.0. You can use String,prototype.localeCompare() with numeric option. Here's an example. It returns 1, meaning 1.10.0 goes after 1.2.0:

'1.10.0'.localeCompare('1.2.0', undefined, {numeric: true, sensitivity: 'base'});

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

};
const existingChart = normalizedCharts.findIndex((hlc) => hlc.obj?.name === chartName);
if (existingChart > -1) {
if (normalizedCharts[existingChart].obj?.version < helmChart.obj.version) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably better to use natural sort here for cases like 1.10.0 > 1.2.0. You can use String,prototype.localeCompare() with numeric option. Here's an example. It returns 1, meaning 1.10.0 goes after 1.2.0:

'1.10.0'.localeCompare('1.2.0', undefined, {numeric: true, sensitivity: 'base'});

@@ -19,6 +19,8 @@ type Metadata = { uid?: string; name?: string; namespace?: string };

export type Item = {
obj?: {
name?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

You don't need this change now.

(hlc) => hlc.obj?.name === chartName,
);
if (existingChartIndex > -1) {
const versionCompare = helmChart.obj.version.localeCompare(
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const versionCompare = helmChart.obj.version.localeCompare(
const versionCompare = helmChart.obj?.version?.localeCompare(

@debsmita1
Copy link
Contributor

verified this locally, works fine
/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 16, 2020
Copy link
Contributor

@rohitkrai03 rohitkrai03 left a comment

Choose a reason for hiding this comment

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

/lgtm

@rohitkrai03
Copy link
Contributor

/assign @christianvogt

@christianvogt
Copy link
Contributor

/approve

@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abhinandan13jan, christianvogt, debsmita1, rohitkrai03

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 18, 2020
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

1 similar comment
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 06f5b98 into openshift:master Jun 19, 2020
@spadgett spadgett added this to the v4.6 milestone Jun 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. component/core Related to console core functionality lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants