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

responding to review comments

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2021-04-27 08:51:23 -04:00
parent 159ff5c98e
commit 847c618a2a
8 changed files with 45 additions and 41 deletions

View File

@ -172,7 +172,6 @@
"@hapi/call": "^8.0.0",
"@hapi/subtext": "^7.0.3",
"@kubernetes/client-node": "^0.12.0",
"@material-ui/icons": "^4.11.2",
"abort-controller": "^3.0.0",
"array-move": "^3.0.0",
"await-lock": "^2.1.0",
@ -234,6 +233,7 @@
"devDependencies": {
"@emeraldpay/hashicon-react": "^0.4.0",
"@material-ui/core": "^4.10.1",
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.57",
"@pmmmwh/react-refresh-webpack-plugin": "^0.4.3",
"@testing-library/jest-dom": "^5.11.10",
@ -341,7 +341,7 @@
"sharp": "^0.26.1",
"spectron": "11.0.0",
"style-loader": "^1.2.1",
"ts-jest": "^26.1.0",
"ts-jest": "26.3.0",
"ts-loader": "^7.0.5",
"ts-node": "^8.10.2",
"type-fest": "^1.0.2",

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

View File

@ -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";

View File

@ -1 +1 @@
export { KubeconfigSyncManager } from "./kubeconfig-sync.source";
export { KubeconfigSyncManager } from "./kubeconfig-sync";

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);

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>
);
}

View File

@ -13657,7 +13657,7 @@ ts-essentials@^4.0.0:
resolved "https://registry.yarnpkg.com/ts-essentials/-/ts-essentials-4.0.0.tgz#506c42b270bbd0465574b90416533175b09205ab"
integrity sha512-uQJX+SRY9mtbKU+g9kl5Fi7AEMofPCvHfJkQlaygpPmHPZrtgaBqbWFOYyiA47RhnSwwnXdepUJrgqUYxoUyhQ==
ts-jest@^26.1.0:
ts-jest@26.3.0:
version "26.3.0"
resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.3.0.tgz#6b2845045347dce394f069bb59358253bc1338a9"
integrity sha512-Jq2uKfx6bPd9+JDpZNMBJMdMQUC3sJ08acISj8NXlVgR2d5OqslEHOR2KHMgwymu8h50+lKIm0m0xj/ioYdW2Q==