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

Styling Kubernetes tab

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2021-04-02 11:57:36 +03:00
parent f8db743bb6
commit b769335dd2
5 changed files with 66 additions and 48 deletions

View File

@ -1,11 +1,11 @@
import React, { useState } from "react";
import { Checkbox } from "../checkbox";
import { Input, InputValidators } from "../input";
import { SubTitle } from "../layout/sub-title";
import { UserPreferences, userStore } from "../../../common/user-store";
import { observer } from "mobx-react";
import { bundledKubectlPath } from "../../../main/kubectl";
import { SelectOption, Select } from "../select";
import { FormSwitch, Switcher } from "../switch";
export const KubectlBinaries = observer(({ preferences }: { preferences: UserPreferences }) => {
const [downloadPath, setDownloadPath] = useState(preferences.downloadBinariesPath || "");
@ -24,46 +24,65 @@ export const KubectlBinaries = observer(({ preferences }: { preferences: UserPre
return (
<>
<SubTitle title="Automatic kubectl binary download"/>
<Checkbox
label="Download kubectl binaries matching the Kubernetes cluster version"
value={preferences.downloadKubectlBinaries}
onChange={downloadKubectlBinaries => preferences.downloadKubectlBinaries = downloadKubectlBinaries}
/>
<SubTitle title="Download mirror" />
<Select
placeholder="Download mirror for kubectl"
options={downloadMirrorOptions}
value={preferences.downloadMirror}
onChange={({ value }: SelectOption) => preferences.downloadMirror = value}
disabled={!preferences.downloadKubectlBinaries}
/>
<SubTitle title="Directory for binaries" />
<Input
theme="round-black"
value={downloadPath}
placeholder={userStore.getDefaultKubectlPath()}
validators={pathValidator}
onChange={setDownloadPath}
onBlur={save}
disabled={!preferences.downloadKubectlBinaries}
/>
<small className="hint">
The directory to download binaries into.
</small>
<SubTitle title="Path to kubectl binary" />
<Input
theme="round-black"
placeholder={bundledKubectlPath()}
value={binariesPath}
validators={pathValidator}
onChange={setBinariesPath}
onBlur={save}
disabled={preferences.downloadKubectlBinaries}
/>
<small className="hint">
The path to the kubectl binary on the system.
</small>
<section className="small">
<SubTitle title="Kubectl binary download"/>
<FormSwitch
control={
<Switcher
checked={preferences.downloadKubectlBinaries}
onChange={v => preferences.downloadKubectlBinaries = v.target.checked}
name="kubectl-download"
/>
}
label="Download kubectl binaries matching the Kubernetes cluster version"
/>
</section>
<hr className="small"/>
<section className="small">
<SubTitle title="Download mirror" />
<Select
placeholder="Download mirror for kubectl"
options={downloadMirrorOptions}
value={preferences.downloadMirror}
onChange={({ value }: SelectOption) => preferences.downloadMirror = value}
disabled={!preferences.downloadKubectlBinaries}
/>
</section>
<hr className="small"/>
<section className="small">
<SubTitle title="Directory for binaries" />
<Input
theme="round-black"
value={downloadPath}
placeholder={userStore.getDefaultKubectlPath()}
validators={pathValidator}
onChange={setDownloadPath}
onBlur={save}
disabled={!preferences.downloadKubectlBinaries}
/>
<div className="hint">
The directory to download binaries into.
</div>
</section>
<hr className="small"/>
<section className="small">
<SubTitle title="Path to kubectl binary" />
<Input
theme="round-black"
placeholder={bundledKubectlPath()}
value={binariesPath}
validators={pathValidator}
onChange={setBinariesPath}
onBlur={save}
disabled={preferences.downloadKubectlBinaries}
/>
</section>
</>
);
});

View File

@ -181,13 +181,11 @@ export class Preferences extends React.Component {
{this.activeTab == PreferencesTab.Kubernetes && (
<section id="kubernetes">
<section>
<h1>Kubernetes</h1>
</section>
<section id="kubectl">
<h2>Kubectl binary</h2>
<h2>Kubernetes</h2>
<KubectlBinaries preferences={preferences}/>
</section>
<hr/>
<section id="helm">
<h2>Helm Charts</h2>
<HelmCharts/>

View File

@ -97,7 +97,7 @@
label {
background: #00000021;
border: 1px solid #20222580;
border: 1px solid #202225bf;
border-radius: 4px;
padding: $padding;

View File

@ -145,7 +145,7 @@
.Select {
&__control {
box-shadow: 0 0 0 1px #20222580;
box-shadow: 0 0 0 1px #202225bf;
background: #00000021;
}
@ -196,6 +196,7 @@
margin-bottom: 8px;
padding-bottom: 0;
font-size: 12px;
line-height: 1;
}
hr {

View File

@ -77,7 +77,7 @@ export class PageLayout extends React.Component<PageLayoutProps> {
</div>
<div className="toolsRegion">
<div className="fixedTools">
<div className="closeBtn" role="button" aria-label="Close">
<div className="closeBtn" role="button" aria-label="Close" onClick={this.back}>
<Icon material="close"/>
</div>
<div className="esc" aria-hidden="true">