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:
parent
fe1c15a7f0
commit
7e732c0da2
@ -6,10 +6,10 @@ import { promiseExec } from "../promise-exec";
|
|||||||
import { helmCli } from "./helm-cli";
|
import { helmCli } from "./helm-cli";
|
||||||
import { HelmChart } from "../../renderer/api/endpoints/helm-charts.api";
|
import { HelmChart } from "../../renderer/api/endpoints/helm-charts.api";
|
||||||
|
|
||||||
type HelmGroups = { [key: string]: HelmChart[] };
|
export type HelmChartGroups = { [key: string]: HelmChart[] };
|
||||||
|
|
||||||
type CachedYaml = {
|
type CachedYaml = {
|
||||||
entries: HelmGroups
|
entries: HelmChartGroups
|
||||||
};
|
};
|
||||||
|
|
||||||
export class HelmChartManager {
|
export class HelmChartManager {
|
||||||
@ -27,7 +27,7 @@ export class HelmChartManager {
|
|||||||
return charts[name];
|
return charts[name];
|
||||||
}
|
}
|
||||||
|
|
||||||
public async charts(): Promise<HelmGroups> {
|
public async charts(): Promise<HelmChartGroups> {
|
||||||
try {
|
try {
|
||||||
const cachedYaml = await this.cachedYaml();
|
const cachedYaml = await this.cachedYaml();
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,8 @@ import { HelmChartManager } from "./helm-chart-manager";
|
|||||||
import { releaseManager } from "./helm-release-manager";
|
import { releaseManager } from "./helm-release-manager";
|
||||||
import { HelmChart } from "../../renderer/api/endpoints/helm-charts.api";
|
import { HelmChart } from "../../renderer/api/endpoints/helm-charts.api";
|
||||||
|
|
||||||
|
import type { HelmChartGroups } from "./helm-chart-manager";
|
||||||
|
|
||||||
class HelmService {
|
class HelmService {
|
||||||
public async installChart(cluster: Cluster, data: { chart: string; values: {}; name: string; namespace: string; version: string }) {
|
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());
|
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) {
|
for (const repo of repositories) {
|
||||||
charts[repo.name] = {};
|
charts[repo.name] = {};
|
||||||
const manager = new HelmChartManager(repo);
|
const manager = new HelmChartManager(repo);
|
||||||
const { groups } = new HelmChartGroups(await manager.charts());
|
const { groups } = new ChartGroups(await manager.charts());
|
||||||
|
|
||||||
charts[repo.name] = groups;
|
charts[repo.name] = groups;
|
||||||
}
|
}
|
||||||
@ -93,11 +95,11 @@ class HelmService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class HelmChartGroups {
|
class ChartGroups {
|
||||||
items: Map<string, HelmChart[]>;
|
private items: Map<string, HelmChart[]>;
|
||||||
|
|
||||||
constructor(group: { [chartName: string]: HelmChart[] }) {
|
constructor(groups: HelmChartGroups) {
|
||||||
this.items = new Map(Object.entries(group));
|
this.items = new Map(Object.entries(groups));
|
||||||
this.excludeDeprecatedGroups();
|
this.excludeDeprecatedGroups();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user