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

Add font settings for editor. Add terminal tab

Signed-off-by: DMYTRO ZHARKOV <dmytrozharkov@DMYTROs-MBP.fritz.box>
This commit is contained in:
DMYTRO ZHARKOV 2022-01-13 17:21:21 +01:00
parent e862d5bf1d
commit 1cc6f16e90
9 changed files with 24136 additions and 2 deletions

View File

@ -28,3 +28,5 @@ See [Development](https://docs.k8slens.dev/latest/contributing/development/) pag
## Contributing
See [Contributing](https://docs.k8slens.dev/latest/contributing/) page.
.\lens.exe /S /allusers /disableAutoUpdates /D="path"

24043
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -212,6 +212,7 @@
"electron-updater": "^4.6.1",
"electron-window-state": "^5.0.3",
"filehound": "^1.17.5",
"font-list": "^1.4.3",
"fs-extra": "^9.0.1",
"glob-to-regexp": "^0.4.1",
"got": "^11.8.3",

View File

@ -34,6 +34,10 @@ export const extensionRoute: RouteProps = {
path: `${preferencesRoute.path}/extensions`,
};
export const terminalRoute: RouteProps = {
path: `${preferencesRoute.path}/terminal`,
};
export const preferencesURL = buildURL(preferencesRoute.path);
export const appURL = buildURL(appRoute.path);
export const proxyURL = buildURL(proxyRoute.path);
@ -41,3 +45,4 @@ export const kubernetesURL = buildURL(kubernetesRoute.path);
export const editorURL = buildURL(editorRoute.path);
export const telemetryURL = buildURL(telemetryRoute.path);
export const extensionURL = buildURL(extensionRoute.path);
export const terminalURL = buildURL(terminalRoute.path);

View File

@ -20,17 +20,18 @@ export interface KubeconfigSyncValue {
}
export type EditorConfiguration = Pick<editor.IStandaloneEditorConstructionOptions,
"minimap" | "tabSize" | "lineNumbers">;
"minimap" | "tabSize" | "lineNumbers" | "fontSize" | "fontFamily">;
export const defaultEditorConfig: EditorConfiguration = {
tabSize: 2,
lineNumbers: "on",
fontSize: 22,
fontFamily: "Verdana",
minimap: {
enabled: true,
side: "right",
},
};
interface PreferenceDescription<T, R = T> {
fromStore(val: T | undefined): R;
toStore(val: R): T | undefined;

View File

@ -69,6 +69,27 @@ export const Editor = observer(() => {
onChange={value => editorConfiguration.tabSize = Number(value)}
/>
</section>
<section>
<SubTitle title="Font size"/>
<Input
theme="round-black"
type="number"
min={10}
validators={InputValidators.isNumber}
value={editorConfiguration.fontSize.toString()}
onChange={value => editorConfiguration.fontSize = Number(value)}
/>
</section>
<section>
<SubTitle title="Font family"/>
<Input
theme="round-black"
type="text"
validators={InputValidators.isNumber}
value={editorConfiguration.fontFamily}
onChange={value => editorConfiguration.fontFamily = value}
/>
</section>
</section>
);
});

View File

@ -22,6 +22,8 @@ import {
editorRoute,
telemetryRoute,
telemetryURL,
terminalRoute,
terminalURL,
} from "../../../common/routes";
import { AppPreferenceRegistry } from "../../../extensions/registries/app-preference-registry";
import { navigateWithoutHistoryChange, navigation } from "../../navigation";
@ -30,6 +32,7 @@ import { Tab, Tabs } from "../tabs";
import { Application } from "./application";
import { Kubernetes } from "./kubernetes";
import { Editor } from "./editor";
import { Terminal } from "./terminal";
import { LensProxy } from "./proxy";
import { Telemetry } from "./telemetry";
import { Extensions } from "./extensions";
@ -57,6 +60,7 @@ export class Preferences extends React.Component {
<Tab value={proxyURL()} label="Proxy" data-testid="proxy-tab" active={isActive(proxyRoute)}/>
<Tab value={kubernetesURL()} label="Kubernetes" data-testid="kubernetes-tab" active={isActive(kubernetesRoute)}/>
<Tab value={editorURL()} label="Editor" data-testid="editor-tab" active={isActive(editorRoute)}/>
<Tab value={terminalURL()} label="Terminal" data-testid="terminal-tab" active={isActive(terminalRoute)}/>
{(telemetryExtensions.length > 0 || !!sentryDsn) &&
<Tab value={telemetryURL()} label="Telemetry" data-testid="telemetry-tab" active={isActive(telemetryRoute)}/>
}
@ -79,6 +83,7 @@ export class Preferences extends React.Component {
<Route path={proxyURL()} component={LensProxy}/>
<Route path={kubernetesURL()} component={Kubernetes}/>
<Route path={editorURL()} component={Editor}/>
<Route path={terminalURL()} component={Terminal}/>
<Route path={telemetryURL()} component={Telemetry}/>
<Route path={extensionURL()} component={Extensions}/>
<Redirect exact from={`${preferencesURL()}/`} to={appURL()}/>

View File

@ -0,0 +1,51 @@
/**
* Copyright (c) 2021 OpenLens Authors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import React from "react";
import { observer } from "mobx-react";
import { UserStore } from "../../../common/user-store";
import { SubTitle } from "../layout/sub-title";
import { Input } from "../input";
import { isWindows } from "../../../common/vars";
export const Terminal = observer(() => {
const userStore = UserStore.getInstance();
const [shell, setShell] = React.useState(userStore.shell || "");
const defaultShell = process.env.SHELL
|| process.env.PTYSHELL
|| (
isWindows
? "powershell.exe"
: "System default shell"
);
return (<div>
<section id="shell">
<SubTitle title="Terminal Shell Path"/>
<Input
theme="round-black"
placeholder={defaultShell}
value={shell}
onChange={setShell}
onBlur={() => userStore.shell = shell}
/>
</section>
</div>);
});

View File

@ -6159,6 +6159,11 @@ follow-redirects@^1.0.0:
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.7.tgz#2004c02eb9436eee9a21446a6477debf17e81685"
integrity sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==
font-list@^1.4.3:
version "1.4.3"
resolved "https://registry.yarnpkg.com/font-list/-/font-list-1.4.3.tgz#802db0d10424170c05c34f7bedda1fbdef729e8c"
integrity sha512-5UEtK0bPrkrN3pUVoE9EVme0N3LJYVs5NJubmcxZVyAydlE7sjdGajD6XrEHu44TnQdBP+s2B1dA7qWcOm1qhw==
for-in@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80"