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 filtering deprecated charts #3635

Merged
merged 4 commits into from
Aug 24, 2021
Merged

Fix filtering deprecated charts #3635

merged 4 commits into from
Aug 24, 2021

Conversation

Nokel81
Copy link
Collaborator

@Nokel81 Nokel81 commented Aug 18, 2021

  • Always show charts, just disable the option to select them in the
    details view

  • Optimize the loading of repo charts to sort and normalize once

  • Using the structured clone algorithm instead of JSON and fix the cache
    placement

Signed-off-by: Sebastian Malton [email protected]

fixes #3515

- Always show charts, just disable the option to select them in the
  details view

- Optimize the loading of repo charts to sort and normalize once

- Using the structured clone algorithm instead of JSON and fix the cache
  placement

Signed-off-by: Sebastian Malton <[email protected]>
@Nokel81 Nokel81 added the bug Something isn't working label Aug 18, 2021
@Nokel81 Nokel81 added this to the 5.2.0 milestone Aug 18, 2021
@Nokel81 Nokel81 requested a review from a team as a code owner August 18, 2021 17:39
@Nokel81 Nokel81 requested review from Nachasic and jim-docker and removed request for a team August 18, 2021 17:39
Signed-off-by: Sebastian Malton <[email protected]>
Copy link
Contributor

@aleksfront aleksfront left a comment

Choose a reason for hiding this comment

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

Left few minor comments. While testing works okay, fixes the issues listed in #3515. However, unable to find any deprecated chart versions to test this one (versions with line-through visibility) https://github.com/lensapp/lens/pull/3635/files#diff-4ada9d82cde72ab9fa11079e8dd1c571c9d3de88a5a5ff0494ac8c04eea92a25

src/main/helm/helm-chart-manager.ts Outdated Show resolved Hide resolved

export class HelmChartManager {
protected cache: any = {};
protected repo: HelmRepo;
static #cache = new Map<string, Buffer>();
Copy link
Contributor

Choose a reason for hiding this comment

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

We're not using such style anywhere else. Probably better to omit the hash sign?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a better version of private as it is actually enforced at runtime

Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this better? And why mark static property as private? Asking because static property can not be called on instance of a class.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Same reason to mark an instance property as private, so to better model the encapsulation.

A static property that is # (JS private) cannot be accessed by code that is not a static member or an instance member.

src/main/helm/helm-chart-manager.ts Outdated Show resolved Hide resolved
@Nokel81
Copy link
Collaborator Author

Nokel81 commented Aug 19, 2021

However, unable to find any deprecated chart versions to test this one (versions with line-through visibility)

Sure, you can add the grafana https://grafana.github.io/helm-charts repo, then the grafana chart has versions 5.5.7 and 5.5.6 which are deprecated.

Signed-off-by: Sebastian Malton <[email protected]>
iter.map(
charts,
(chart => {
const __version = coerce(chart.version, { includePrerelease: true, loose: true });
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the meaning to use underscores before variable name here? __version?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I meant it as both "temporary" and less likely to conflict with other fields. I chose __version because it is related to the version field but I don't want to override that field.

src/main/helm/helm-chart-manager.ts Outdated Show resolved Hide resolved
Signed-off-by: Sebastian Malton <[email protected]>
@jakolehm jakolehm requested review from panuhorsmalahti and chenhunghan and removed request for Nachasic, panuhorsmalahti and chenhunghan August 24, 2021 06:02
Copy link
Contributor

@aleksfront aleksfront left a comment

Choose a reason for hiding this comment

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

LGTM

@Nokel81 Nokel81 merged commit 5f89b3e into master Aug 24, 2021
@Nokel81 Nokel81 deleted the issue-3515 branch August 24, 2021 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lens doesn't find/list all expected charts
2 participants