responding to review comments

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2021-04-27 09:45:25 -04:00
1 parent 159ff5c98e
commit 847c618a2a
8 files changed
+45 -41

No files matched your search

+5 -3
View File
@@ -29,15 +29,15 @@ function readResolvedPathSync(filePath: string): string {
}
function checkRawCluster(rawCluster: any): boolean {
return rawCluster?.name && rawCluster?.cluster?.server;
return Boolean(rawCluster?.name && rawCluster?.cluster?.server);
}
function checkRawUser(rawUser: any): boolean {
return rawUser?.name;
return Boolean(rawUser?.name);
}
function checkRawContext(rawContext: any): boolean {
return rawContext.name && rawContext.context?.cluster && rawContext.context?.user;
return Boolean(rawContext.name && rawContext.context?.cluster && rawContext.context?.user);
}
export interface KubeConfigOptions {
@@ -206,6 +206,8 @@ export function getNodeWarningConditions(node: V1Node) {
/**
* Checks if `config` has valid `Context`, `User`, `Cluster`, and `exec` fields (if present when required)
*
* Note: This function returns an error instead of throwing it, returning `undefined` if the validation passes
*/
export function validateKubeConfig(config: KubeConfig, contextName: string, validationOpts: KubeConfigValidationOpts = {}): Error | undefined {
// we only receive a single context, cluster & user object here so lets validate them as this
@@ -2,7 +2,7 @@ import { ObservableMap } from "mobx";
import { CatalogEntity } from "../../../common/catalog";
import { loadFromOptions } from "../../../common/kube-helpers";
import { Cluster } from "../../cluster";
import { computeDiff, configToModels } from "../kubeconfig-sync.source";
import { computeDiff, configToModels } from "../kubeconfig-sync";
import mockFs from "mock-fs";
import fs from "fs";
+1 -1
View File
@@ -1 +1 @@
export { KubeconfigSyncManager } from "./kubeconfig-sync.source";
export { KubeconfigSyncManager } from "./kubeconfig-sync";
+1 -33
View File
@@ -21,7 +21,7 @@ import { LensApp } from "./lens-app";
import { ThemeStore } from "./theme.store";
import { HelmRepoManager } from "../main/helm/helm-repo-manager";
import { ExtensionInstallationStateStore } from "./components/+extensions/extension-install.store";
import { createMuiTheme, ThemeProvider } from "@material-ui/core";
import { DefaultProps } from "./mui-base-theme";
/**
* If this is a development buid, wait a second to attach
@@ -97,37 +97,5 @@ export async function bootstrap(App: AppComponent) {
</>, rootElem);
}
const defaultTheme = createMuiTheme({
props: {
MuiIconButton: {
color: "inherit",
},
MuiSvgIcon: {
fontSize: "inherit",
},
MuiTooltip: {
placement: "top",
}
},
overrides: {
MuiIconButton: {
root: {
"&:hover": {
color: "var(--iconActiveColor)",
backgroundColor: "var(--iconActiveBackground)",
}
}
}
},
});
function DefaultProps(App: AppComponent) {
return (
<ThemeProvider theme={defaultTheme}>
<App />
</ThemeProvider>
);
}
// run
bootstrap(process.isMainFrame ? LensApp : App);
+34
View File
@@ -0,0 +1,34 @@
import React from "react";
import { createMuiTheme, ThemeProvider } from "@material-ui/core";
const defaultTheme = createMuiTheme({
props: {
MuiIconButton: {
color: "inherit",
},
MuiSvgIcon: {
fontSize: "inherit",
},
MuiTooltip: {
placement: "top",
}
},
overrides: {
MuiIconButton: {
root: {
"&:hover": {
color: "var(--iconActiveColor)",
backgroundColor: "var(--iconActiveBackground)",
}
}
}
},
});
export function DefaultProps(App: React.ComponentType) {
return (
<ThemeProvider theme= { defaultTheme } >
<App />
</ThemeProvider>
);
}