1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Cleaning up

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2021-02-16 13:11:27 +03:00
parent fe1c15a7f0
commit 7e732c0da2
2 changed files with 10 additions and 8 deletions

View File

@ -6,10 +6,10 @@ import { promiseExec } from "../promise-exec";
import { helmCli } from "./helm-cli";
import { HelmChart } from "../../renderer/api/endpoints/helm-charts.api";
type HelmGroups = { [key: string]: HelmChart[] };
export type HelmChartGroups = { [key: string]: HelmChart[] };
type CachedYaml = {
entries: HelmGroups
entries: HelmChartGroups
};
export class HelmChartManager {
@ -27,7 +27,7 @@ export class HelmChartManager {
return charts[name];
}
public async charts(): Promise<HelmGroups> {
public async charts(): Promise<HelmChartGroups> {
try {
const cachedYaml = await this.cachedYaml();

View File

@ -5,6 +5,8 @@ import { HelmChartManager } from "./helm-chart-manager";
import { releaseManager } from "./helm-release-manager";
import { HelmChart } from "../../renderer/api/endpoints/helm-charts.api";
import type { HelmChartGroups } from "./helm-chart-manager";
class HelmService {
public async installChart(cluster: Cluster, data: { chart: string; values: {}; name: string; namespace: string; version: string }) {
return await releaseManager.installChart(data.chart, data.values, data.name, data.namespace, data.version, cluster.getProxyKubeconfigPath());
@ -19,7 +21,7 @@ class HelmService {
for (const repo of repositories) {
charts[repo.name] = {};
const manager = new HelmChartManager(repo);
const { groups } = new HelmChartGroups(await manager.charts());
const { groups } = new ChartGroups(await manager.charts());
charts[repo.name] = groups;
}
@ -93,11 +95,11 @@ class HelmService {
}
}
class HelmChartGroups {
items: Map<string, HelmChart[]>;
class ChartGroups {
private items: Map<string, HelmChart[]>;
constructor(group: { [chartName: string]: HelmChart[] }) {
this.items = new Map(Object.entries(group));
constructor(groups: HelmChartGroups) {
this.items = new Map(Object.entries(groups));
this.excludeDeprecatedGroups();
}