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);
|
||||
|
||||
/**
|
||||
* Is cluster object initializinng on-going
|
||||
* Is cluster object initializing on-going
|
||||
*
|
||||
* @observable
|
||||
*/
|
||||
|
||||
@ -6,6 +6,13 @@ import { HelmChartManager } from "./helm-chart-manager";
|
||||
import { releaseManager } from "./helm-release-manager";
|
||||
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 {
|
||||
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());
|
||||
@ -95,28 +102,19 @@ class HelmService {
|
||||
}
|
||||
|
||||
private excludeDeprecatedChartGroups(chartGroups: RepoHelmChartList) {
|
||||
const groups = new Map(Object.entries(chartGroups));
|
||||
|
||||
for (const [chartName, charts] of groups) {
|
||||
if (charts[0].deprecated) {
|
||||
groups.delete(chartName);
|
||||
}
|
||||
}
|
||||
|
||||
return Object.fromEntries(groups);
|
||||
return Object.fromEntries(
|
||||
Object.entries(chartGroups)
|
||||
.filter(([, [chart]]) => !chart.deprecated)
|
||||
);
|
||||
}
|
||||
|
||||
private sortChartsByVersion(chartGroups: RepoHelmChartList) {
|
||||
for (const key in chartGroups) {
|
||||
chartGroups[key] = chartGroups[key].sort((first, second) => {
|
||||
const firstVersion = semver.coerce(first.version || 0);
|
||||
const secondVersion = semver.coerce(second.version || 0);
|
||||
|
||||
return semver.compare(secondVersion, firstVersion);
|
||||
});
|
||||
}
|
||||
|
||||
return chartGroups;
|
||||
return sortValues(chartGroups, ({version: left}, {version: right}) => (
|
||||
semver.compare(
|
||||
semver.coerce(right || 0),
|
||||
semver.coerce(left || 0),
|
||||
)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -20,12 +20,12 @@ export const helmChartsApi = {
|
||||
list() {
|
||||
return apiBase
|
||||
.get<HelmChartList>(endpoint())
|
||||
.then(data => {
|
||||
return Object
|
||||
.then(data => (
|
||||
Object
|
||||
.values(data)
|
||||
.reduce((allCharts, repoCharts) => allCharts.concat(Object.values(repoCharts)), [])
|
||||
.map(([chart]) => HelmChart.create(chart));
|
||||
});
|
||||
.flatMap(byRepo => Object.values(byRepo))
|
||||
.map(([chart]) => (console.log(chart), HelmChart.create(chart)))
|
||||
));
|
||||
},
|
||||
|
||||
get(repo: string, name: string, readmeVersion?: string) {
|
||||
|
||||
@ -27,7 +27,7 @@ export function webpackLensRenderer({ showVars = true } = {}): webpack.Configura
|
||||
port: webpackDevServerPort,
|
||||
host: "localhost",
|
||||
hot: true,
|
||||
// to avoid cors errors when requests is from iframes
|
||||
// to avoid CORS errors when requests is from iframes
|
||||
disableHostCheck: true,
|
||||
headers: { "Access-Control-Allow-Origin": "*" },
|
||||
},
|
||||
@ -97,7 +97,7 @@ export function webpackLensRenderer({ showVars = true } = {}): webpack.Configura
|
||||
loader: "file-loader",
|
||||
options: {
|
||||
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