mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
fix spelling in cluster and webpack.renderer
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
e69d008d59
commit
5b066be905
@ -86,7 +86,7 @@ export class Cluster implements ClusterModel, ClusterState {
|
|||||||
whenReady = when(() => this.ready);
|
whenReady = when(() => this.ready);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is cluster object initializinng on-going
|
* Is cluster object initializing on-going
|
||||||
*
|
*
|
||||||
* @observable
|
* @observable
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -6,6 +6,13 @@ import { HelmChartManager } from "./helm-chart-manager";
|
|||||||
import { releaseManager } from "./helm-release-manager";
|
import { releaseManager } from "./helm-release-manager";
|
||||||
import { HelmChartList, RepoHelmChartList } from "../../renderer/api/endpoints/helm-charts.api";
|
import { HelmChartList, RepoHelmChartList } from "../../renderer/api/endpoints/helm-charts.api";
|
||||||
|
|
||||||
|
function sortValues<T>(src: Record<string | number | symbol, T[]>, compare: (left: T, right: T) => number): Record<string | number | symbol, T[]> {
|
||||||
|
return Object.fromEntries(
|
||||||
|
Object.entries(src)
|
||||||
|
.map(([key, values]) => [key, values.sort(compare)])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
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());
|
||||||
@ -95,28 +102,19 @@ class HelmService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private excludeDeprecatedChartGroups(chartGroups: RepoHelmChartList) {
|
private excludeDeprecatedChartGroups(chartGroups: RepoHelmChartList) {
|
||||||
const groups = new Map(Object.entries(chartGroups));
|
return Object.fromEntries(
|
||||||
|
Object.entries(chartGroups)
|
||||||
for (const [chartName, charts] of groups) {
|
.filter(([, [chart]]) => !chart.deprecated)
|
||||||
if (charts[0].deprecated) {
|
);
|
||||||
groups.delete(chartName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Object.fromEntries(groups);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private sortChartsByVersion(chartGroups: RepoHelmChartList) {
|
private sortChartsByVersion(chartGroups: RepoHelmChartList) {
|
||||||
for (const key in chartGroups) {
|
return sortValues(chartGroups, ({version: left}, {version: right}) => (
|
||||||
chartGroups[key] = chartGroups[key].sort((first, second) => {
|
semver.compare(
|
||||||
const firstVersion = semver.coerce(first.version || 0);
|
semver.coerce(right || 0),
|
||||||
const secondVersion = semver.coerce(second.version || 0);
|
semver.coerce(left || 0),
|
||||||
|
)
|
||||||
return semver.compare(secondVersion, firstVersion);
|
));
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return chartGroups;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -20,12 +20,12 @@ export const helmChartsApi = {
|
|||||||
list() {
|
list() {
|
||||||
return apiBase
|
return apiBase
|
||||||
.get<HelmChartList>(endpoint())
|
.get<HelmChartList>(endpoint())
|
||||||
.then(data => {
|
.then(data => (
|
||||||
return Object
|
Object
|
||||||
.values(data)
|
.values(data)
|
||||||
.reduce((allCharts, repoCharts) => allCharts.concat(Object.values(repoCharts)), [])
|
.flatMap(byRepo => Object.values(byRepo))
|
||||||
.map(([chart]) => HelmChart.create(chart));
|
.map(([chart]) => (console.log(chart), HelmChart.create(chart)))
|
||||||
});
|
));
|
||||||
},
|
},
|
||||||
|
|
||||||
get(repo: string, name: string, readmeVersion?: string) {
|
get(repo: string, name: string, readmeVersion?: string) {
|
||||||
|
|||||||
@ -27,7 +27,7 @@ export function webpackLensRenderer({ showVars = true } = {}): webpack.Configura
|
|||||||
port: webpackDevServerPort,
|
port: webpackDevServerPort,
|
||||||
host: "localhost",
|
host: "localhost",
|
||||||
hot: true,
|
hot: true,
|
||||||
// to avoid cors errors when requests is from iframes
|
// to avoid CORS errors when requests is from iframes
|
||||||
disableHostCheck: true,
|
disableHostCheck: true,
|
||||||
headers: { "Access-Control-Allow-Origin": "*" },
|
headers: { "Access-Control-Allow-Origin": "*" },
|
||||||
},
|
},
|
||||||
@ -97,7 +97,7 @@ export function webpackLensRenderer({ showVars = true } = {}): webpack.Configura
|
|||||||
loader: "file-loader",
|
loader: "file-loader",
|
||||||
options: {
|
options: {
|
||||||
name: "images/[name]-[hash:6].[ext]",
|
name: "images/[name]-[hash:6].[ext]",
|
||||||
esModule: false, // handle media imports in <template>, e.g <img src="../assets/logo.svg"> (vue/react?)
|
esModule: false, // handle media imports in <template>, e.g <img src="../assets/logo.svg"> (react)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user