import "./preferences.scss"; import React from "react"; import { computed, observable, reaction } from "mobx"; import { disposeOnUnmount, observer } from "mobx-react"; import { userStore } from "../../../common/user-store"; import { isWindows } from "../../../common/vars"; import { appPreferenceRegistry } from "../../../extensions/registries/app-preference-registry"; import { themeStore } from "../../theme.store"; import { Checkbox } from "../checkbox"; import { Input } from "../input"; import { PageLayout } from "../layout/page-layout"; import { SubTitle } from "../layout/sub-title"; import { Select, SelectOption } from "../select"; import { HelmCharts } from "./helm-charts"; import { KubectlBinaries } from "./kubectl-binaries"; import { navigation } from "../../navigation"; import { Tab, Tabs } from "../tabs"; import { FormSwitch, Switcher } from "../switch"; enum PreferencesTab { Application = "application", Proxy = "proxy", Kubernetes = "kubernetes", Extensions = "extensions" } @observer export class Preferences extends React.Component { @observable httpProxy = userStore.preferences.httpsProxy || ""; @observable shell = userStore.preferences.shell || ""; @observable activeTab = PreferencesTab.Application; @computed get themeOptions(): SelectOption[] { return themeStore.themes.map(theme => ({ label: theme.name, value: theme.id, })); } componentDidMount() { disposeOnUnmount(this, [ reaction(() => navigation.location.hash, hash => { const fragment = hash.slice(1); // hash is /^(#\w.)?$/ if (fragment) { // ignore empty framents document.getElementById(fragment)?.scrollIntoView(); } }, { fireImmediately: true }) ]); } onTabChange = (tabId: PreferencesTab) => { this.activeTab = tabId; }; renderNavigation() { return (
Preferences
); } render() { const { preferences } = userStore; let defaultShell = process.env.SHELL || process.env.PTYSHELL; if (!defaultShell) { if (isWindows) { defaultShell = "powershell.exe"; } else { defaultShell = "System default shell"; } } return ( {this.activeTab == PreferencesTab.Application && (

Appearance

this.shell = v} onBlur={() => preferences.shell = this.shell} />
The path of the shell that the terminal uses.

Start-up

preferences.openAtLogin = v.target.checked} name="startup" /> } label="Automatically start Lens on login" />
)} {this.activeTab == PreferencesTab.Proxy && (

Proxy

this.httpProxy = v} onBlur={() => preferences.httpsProxy = this.httpProxy} /> Proxy is used only for non-cluster communication. preferences.allowUntrustedCAs = v} /> This will make Lens to trust ANY certificate authority without any validations.{" "} Needed with some corporate proxies that do certificate re-writing.{" "} Does not affect cluster communications!
)} {this.activeTab == PreferencesTab.Kubernetes && (

Kubernetes

Kubectl binary

Helm Charts

)} {this.activeTab == PreferencesTab.Extensions && (

Extensions

{appPreferenceRegistry.getItems().map(({ title, id, components: { Hint, Input } }, index) => { return (

{title}

); })}
)}
); } }