Fix: deprecated helm chart filtering (#2158)

* Refactor of excludeDeprecated helm service method

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Pick first helm chart from the list on load

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Removing helm filtering in UI

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Cleaning up

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Cleaning up type definitions

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Adding sorting charts by version

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Adding tests for methods that manipute chart listing

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Cleaning up tests a bit

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Adding semver coercion before comparing versions

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev authored and GitHub committed 2021-02-24 10:20:06 +03:00
1 parent 103467d31b
commit 6876d774a5
6 files changed
+246 -31

No files matched your search

@@ -3,11 +3,8 @@ import { apiBase } from "../index";
import { stringify } from "querystring";
import { autobind } from "../../utils";
interface IHelmChartList {
[repo: string]: {
[name: string]: HelmChart;
};
}
export type RepoHelmChartList = Record<string, HelmChart[]>;
export type HelmChartList = Record<string, RepoHelmChartList>;
export interface IHelmChartDetails {
readme: string;
@@ -22,12 +19,12 @@ const endpoint = compile(`/v2/charts/:repo?/:name?`) as (params?: {
export const helmChartsApi = {
list() {
return apiBase
.get<IHelmChartList>(endpoint())
.get<HelmChartList>(endpoint())
.then(data => {
return Object
.values(data)
.reduce((allCharts, repoCharts) => allCharts.concat(Object.values(repoCharts)), [])
.map(HelmChart.create);
.map(([chart]) => HelmChart.create(chart));
});
},