From 2f53e7606089e6588e0a6988063fbbaa6991614a Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Wed, 23 Sep 2020 08:57:34 -0400 Subject: [PATCH 1/2] reduce height on draggable-top and only render it on macos (#942) * reduce height on draggable-top and only render it on macos * move drag bar out of app and into bootstrap Signed-off-by: Sebastian Malton --- src/renderer/bootstrap.tsx | 5 ++++- src/renderer/components/app.scss | 3 ++- .../cluster-manager/cluster-manager.tsx | 22 +++++++++---------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/renderer/bootstrap.tsx b/src/renderer/bootstrap.tsx index 80c27cb418..e42a456884 100644 --- a/src/renderer/bootstrap.tsx +++ b/src/renderer/bootstrap.tsx @@ -31,7 +31,10 @@ export async function bootstrap(App: AppComponent) { if (App.init) { await App.init(); } - render(, rootElem); + render(<> + {isMac &&
} + + , rootElem); } // run diff --git a/src/renderer/components/app.scss b/src/renderer/components/app.scss index 717c47bb1b..20ca08df66 100755 --- a/src/renderer/components/app.scss +++ b/src/renderer/components/app.scss @@ -13,6 +13,7 @@ :root { --mainBackground: #1e2124; --main-layout-header: 40px; + --drag-region-height: 22px } ::selection { @@ -47,7 +48,7 @@ html, body { left: 0; top: 0; width: 100%; - height: var(--main-layout-header); + height: var(--drag-region-height); z-index: 1000; pointer-events: none; } diff --git a/src/renderer/components/cluster-manager/cluster-manager.tsx b/src/renderer/components/cluster-manager/cluster-manager.tsx index db0026bf75..c658a31aa4 100644 --- a/src/renderer/components/cluster-manager/cluster-manager.tsx +++ b/src/renderer/components/cluster-manager/cluster-manager.tsx @@ -14,6 +14,7 @@ import { ClusterSettings, clusterSettingsRoute } from "../+cluster-settings"; import { clusterViewRoute, clusterViewURL, getMatchedCluster, getMatchedClusterId } from "./cluster-view.route"; import { clusterStore } from "../../../common/cluster-store"; import { hasLoadedView, initView, lensViews, refreshViews } from "./lens-views"; +import { isMac } from "../../../common/vars"; @observer export class ClusterManager extends React.Component { @@ -53,21 +54,20 @@ export class ClusterManager extends React.Component { render() { return (
-
-
+
- - - - - - - + + + + + + +
- - + +
) } From b88c0d4fbf8eee5efd81146afd4293574c796f9f Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Wed, 23 Sep 2020 08:57:51 -0400 Subject: [PATCH 2/2] Make download dir option consistent with other settings (#875) * make download dir option consitent with other settings * make path to kubectl setting consistent Co-authored-by: Lauri Nevala Signed-off-by: Sebastian Malton Co-authored-by: Sebastian Malton Co-authored-by: Lauri Nevala --- src/common/user-store.ts | 2 - src/main/kubectl.ts | 10 ++-- .../+preferences/kubectl-binaries.tsx | 52 ++++++++----------- 3 files changed, 28 insertions(+), 36 deletions(-) diff --git a/src/common/user-store.ts b/src/common/user-store.ts index a0cfe09fd5..f7d3ade005 100644 --- a/src/common/user-store.ts +++ b/src/common/user-store.ts @@ -59,8 +59,6 @@ export class UserStore extends BaseStore { colorTheme: UserStore.defaultTheme, downloadMirror: "default", downloadKubectlBinaries: true, // Download kubectl binaries matching cluster version - downloadBinariesPath: this.getDefaultKubectlPath(), - kubectlBinariesPath: "" }; get isNewVersion() { diff --git a/src/main/kubectl.ts b/src/main/kubectl.ts index afb7a89111..1e57e29d5d 100644 --- a/src/main/kubectl.ts +++ b/src/main/kubectl.ts @@ -36,7 +36,7 @@ const packageMirrors: Map = new Map([ let bundledPath: string const initScriptVersionString = "# lens-initscript v3\n" -if (isDevelopment || isTestEnv) { +if (isDevelopment || isTestEnv) { const platformName = isWindows ? "windows" : process.platform bundledPath = path.join(process.cwd(), "binaries", "client", platformName, process.arch, "kubectl") } else { @@ -110,7 +110,11 @@ export class Kubectl { } protected getDownloadDir() { - return userStore.preferences?.downloadBinariesPath || Kubectl.kubectlDir + if (userStore.preferences?.downloadBinariesPath) { + return path.join(userStore.preferences.downloadBinariesPath, "kubectl") + } + + return Kubectl.kubectlDir } public async getPath(bundled = false): Promise { @@ -214,7 +218,7 @@ export class Kubectl { }); isValid = !await this.checkBinary(this.path, false) } - if(!isValid) { + if (!isValid) { logger.debug(`Releasing lock for ${this.kubectlVersion}`) release() return false diff --git a/src/renderer/components/+preferences/kubectl-binaries.tsx b/src/renderer/components/+preferences/kubectl-binaries.tsx index 15b01251f4..c57ab1b8a2 100644 --- a/src/renderer/components/+preferences/kubectl-binaries.tsx +++ b/src/renderer/components/+preferences/kubectl-binaries.tsx @@ -18,44 +18,22 @@ export const KubectlBinaries = observer(({ preferences }: { preferences: UserPre { value: "china", label: "China (Azure)" }, ] - const save = () => { preferences.downloadBinariesPath = downloadPath; preferences.kubectlBinariesPath = binariesPath; } - const renderPath = () => { - if (preferences.downloadKubectlBinaries) { - return null; - } - return ( - <> - - - - Default:{" "}{Kubectl.bundledKubectlPath} - - - ); - } - return ( <>

Kubectl Binary

- - Download kubectl binaries matching to Kubernetes cluster verison. - Download kubectl binaries} value={preferences.downloadKubectlBinaries} onChange={downloadKubectlBinaries => preferences.downloadKubectlBinaries = downloadKubectlBinaries} /> + + Download kubectl binaries matching to Kubernetes cluster version. + - - Default: {userStore.getDefaultKubectlPath()} + + The directory to download binaries into. + + + + + The path to the kubectl binary on the system. - {renderPath()} ); -}); \ No newline at end of file +});