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

Fix fetching values from onChange callback

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2021-12-28 08:10:36 +03:00
parent 8a0871230b
commit 8a02c5c0e0
5 changed files with 15 additions and 6 deletions

View File

@ -86,7 +86,10 @@ export const Application = observer(() => {
<section id="terminalSelection"> <section id="terminalSelection">
<SubTitle title="Terminal copy & paste" /> <SubTitle title="Terminal copy & paste" />
<Switch checked={userStore.terminalCopyOnSelect} onChange={v => userStore.terminalCopyOnSelect = v.target.checked}> <Switch
checked={userStore.terminalCopyOnSelect}
onChange={() => userStore.terminalCopyOnSelect = !userStore.terminalCopyOnSelect}
>
Copy on select and paste on right-click Copy on select and paste on right-click
</Switch> </Switch>
</section> </section>
@ -128,7 +131,7 @@ export const Application = observer(() => {
<section id="other"> <section id="other">
<SubTitle title="Start-up"/> <SubTitle title="Start-up"/>
<Switch checked={userStore.openAtLogin} onChange={v => userStore.openAtLogin = v.target.checked}> <Switch checked={userStore.openAtLogin} onChange={() => userStore.openAtLogin = !userStore.openAtLogin}>
Automatically start Lens on login Automatically start Lens on login
</Switch> </Switch>
</section> </section>

View File

@ -45,7 +45,10 @@ export const Editor = observer(() => {
<section> <section>
<div className="flex gaps justify-space-between"> <div className="flex gaps justify-space-between">
<div className="flex gaps align-center"> <div className="flex gaps align-center">
<Switch checked={editorConfiguration.minimap.enabled} onChange={v => editorConfiguration.minimap.enabled = v.target.checked}> <Switch
checked={editorConfiguration.minimap.enabled}
onChange={() => editorConfiguration.minimap.enabled = !editorConfiguration.minimap.enabled}
>
Copy on select and paste on right-click Copy on select and paste on right-click
</Switch> </Switch>
</div> </div>

View File

@ -48,7 +48,10 @@ export const KubectlBinaries = observer(() => {
<> <>
<section> <section>
<SubTitle title="Kubectl binary download"/> <SubTitle title="Kubectl binary download"/>
<Switch checked={userStore.downloadKubectlBinaries} onChange={v => userStore.downloadKubectlBinaries = v.target.checked}> <Switch
checked={userStore.downloadKubectlBinaries}
onChange={() => userStore.downloadKubectlBinaries = !userStore.downloadKubectlBinaries}
>
Download kubectl binaries matching the Kubernetes cluster version Download kubectl binaries matching the Kubernetes cluster version
</Switch> </Switch>
</section> </section>

View File

@ -28,6 +28,7 @@ import { Switch } from "../switch";
export const LensProxy = observer(() => { export const LensProxy = observer(() => {
const [proxy, setProxy] = React.useState(UserStore.getInstance().httpsProxy || ""); const [proxy, setProxy] = React.useState(UserStore.getInstance().httpsProxy || "");
const store = UserStore.getInstance();
return ( return (
<section id="proxy"> <section id="proxy">
@ -50,7 +51,7 @@ export const LensProxy = observer(() => {
<section className="small"> <section className="small">
<SubTitle title="Certificate Trust"/> <SubTitle title="Certificate Trust"/>
<Switch checked={UserStore.getInstance().allowUntrustedCAs} onChange={v => UserStore.getInstance().allowUntrustedCAs = v.target.checked}> <Switch checked={store.allowUntrustedCAs} onChange={() => store.allowUntrustedCAs = !store.allowUntrustedCAs}>
Allow untrusted Certificate Authorities Allow untrusted Certificate Authorities
</Switch> </Switch>
<small className="hint"> <small className="hint">

View File

@ -25,7 +25,6 @@ import React from "react";
import { cssNames } from "../../utils"; import { cssNames } from "../../utils";
interface Props extends React.HTMLProps<HTMLInputElement> { interface Props extends React.HTMLProps<HTMLInputElement> {
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
} }
export function Switch({ children, disabled, ...props }: Props) { export function Switch({ children, disabled, ...props }: Props) {