mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
make path to kubectl setting consistent
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
f299b84fd4
commit
4e9c6d73c4
@ -13,40 +13,16 @@ export const KubectlBinaries = observer(({ preferences }: { preferences: UserPre
|
|||||||
const [downloadPath, setDownloadPath] = useState(preferences.downloadBinariesPath || "");
|
const [downloadPath, setDownloadPath] = useState(preferences.downloadBinariesPath || "");
|
||||||
const [binariesPath, setBinariesPath] = useState(preferences.kubectlBinariesPath || "");
|
const [binariesPath, setBinariesPath] = useState(preferences.kubectlBinariesPath || "");
|
||||||
|
|
||||||
console.log(preferences);
|
|
||||||
|
|
||||||
const downloadMirrorOptions: SelectOption<string>[] = [
|
const downloadMirrorOptions: SelectOption<string>[] = [
|
||||||
{ value: "default", label: "Default (Google)" },
|
{ value: "default", label: "Default (Google)" },
|
||||||
{ value: "china", label: "China (Azure)" },
|
{ value: "china", label: "China (Azure)" },
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
const save = () => {
|
const save = () => {
|
||||||
preferences.downloadBinariesPath = downloadPath;
|
preferences.downloadBinariesPath = downloadPath;
|
||||||
preferences.kubectlBinariesPath = binariesPath;
|
preferences.kubectlBinariesPath = binariesPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
const renderPath = () => {
|
|
||||||
if (preferences.downloadKubectlBinaries) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<SubTitle title="Path to Kubectl binary" />
|
|
||||||
<Input
|
|
||||||
theme="round-black"
|
|
||||||
value={binariesPath}
|
|
||||||
validators={isPath}
|
|
||||||
onChange={setBinariesPath}
|
|
||||||
onBlur={save}
|
|
||||||
/>
|
|
||||||
<small className="hint">
|
|
||||||
<Trans>Default:</Trans>{" "}{Kubectl.bundledKubectlPath}
|
|
||||||
</small>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<h2><Trans>Kubectl Binary</Trans></h2>
|
<h2><Trans>Kubectl Binary</Trans></h2>
|
||||||
@ -70,7 +46,7 @@ export const KubectlBinaries = observer(({ preferences }: { preferences: UserPre
|
|||||||
<Input
|
<Input
|
||||||
theme="round-black"
|
theme="round-black"
|
||||||
value={downloadPath}
|
value={downloadPath}
|
||||||
placeholder={`Default: ${userStore.getDefaultKubectlPath()}`}
|
placeholder={userStore.getDefaultKubectlPath()}
|
||||||
validators={isPath}
|
validators={isPath}
|
||||||
onChange={setDownloadPath}
|
onChange={setDownloadPath}
|
||||||
onBlur={save}
|
onBlur={save}
|
||||||
@ -79,7 +55,19 @@ export const KubectlBinaries = observer(({ preferences }: { preferences: UserPre
|
|||||||
<small className="hint">
|
<small className="hint">
|
||||||
The directory to download binaries into.
|
The directory to download binaries into.
|
||||||
</small>
|
</small>
|
||||||
{renderPath()}
|
<SubTitle title="Path to Kubectl binary" />
|
||||||
|
<Input
|
||||||
|
theme="round-black"
|
||||||
|
placeholder={Kubectl.bundledKubectlPath}
|
||||||
|
value={binariesPath}
|
||||||
|
validators={isPath}
|
||||||
|
onChange={setBinariesPath}
|
||||||
|
onBlur={save}
|
||||||
|
disabled={preferences.downloadKubectlBinaries}
|
||||||
|
/>
|
||||||
|
<small className="hint">
|
||||||
|
<Trans>The path to the kubectl binary on the system.</Trans>
|
||||||
|
</small>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user