mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Merge branch 'master' into preferences-scrollspy
This commit is contained in:
commit
55ccfced93
@ -20,6 +20,7 @@ export interface UserStoreModel {
|
|||||||
|
|
||||||
export interface UserPreferences {
|
export interface UserPreferences {
|
||||||
httpsProxy?: string;
|
httpsProxy?: string;
|
||||||
|
shell?: string;
|
||||||
colorTheme?: string;
|
colorTheme?: string;
|
||||||
allowUntrustedCAs?: boolean;
|
allowUntrustedCAs?: boolean;
|
||||||
allowTelemetry?: boolean;
|
allowTelemetry?: boolean;
|
||||||
|
|||||||
@ -252,7 +252,7 @@ export class Cluster implements ClusterModel, ClusterState {
|
|||||||
* Kubernetes version
|
* Kubernetes version
|
||||||
*/
|
*/
|
||||||
get version(): string {
|
get version(): string {
|
||||||
return String(this.metadata?.version || "");
|
return String(this.metadata?.version ?? "");
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(model: ClusterModel) {
|
constructor(model: ClusterModel) {
|
||||||
|
|||||||
@ -105,10 +105,11 @@ export class ShellSession extends EventEmitter {
|
|||||||
protected async getShellEnv() {
|
protected async getShellEnv() {
|
||||||
const env = JSON.parse(JSON.stringify(await shellEnv()));
|
const env = JSON.parse(JSON.stringify(await shellEnv()));
|
||||||
const pathStr = [this.kubectlBinDir, this.helmBinDir, process.env.PATH].join(path.delimiter);
|
const pathStr = [this.kubectlBinDir, this.helmBinDir, process.env.PATH].join(path.delimiter);
|
||||||
|
const shell = userStore.preferences.shell || process.env.SHELL || process.env.PTYSHELL;
|
||||||
|
|
||||||
if(isWindows) {
|
if(isWindows) {
|
||||||
env["SystemRoot"] = process.env.SystemRoot;
|
env["SystemRoot"] = process.env.SystemRoot;
|
||||||
env["PTYSHELL"] = process.env.SHELL || "powershell.exe";
|
env["PTYSHELL"] = shell || "powershell.exe";
|
||||||
env["PATH"] = pathStr;
|
env["PATH"] = pathStr;
|
||||||
env["LENS_SESSION"] = "true";
|
env["LENS_SESSION"] = "true";
|
||||||
const lensWslEnv = "KUBECONFIG/up:LENS_SESSION/u";
|
const lensWslEnv = "KUBECONFIG/up:LENS_SESSION/u";
|
||||||
@ -118,8 +119,8 @@ export class ShellSession extends EventEmitter {
|
|||||||
} else {
|
} else {
|
||||||
env["WSLENV"] = lensWslEnv;
|
env["WSLENV"] = lensWslEnv;
|
||||||
}
|
}
|
||||||
} else if(typeof(process.env.SHELL) != "undefined") {
|
} else if(shell !== undefined) {
|
||||||
env["PTYSHELL"] = process.env.SHELL;
|
env["PTYSHELL"] = shell;
|
||||||
env["PATH"] = pathStr;
|
env["PATH"] = pathStr;
|
||||||
} else {
|
} else {
|
||||||
env["PTYSHELL"] = ""; // blank runs the system default shell
|
env["PTYSHELL"] = ""; // blank runs the system default shell
|
||||||
|
|||||||
@ -10,7 +10,6 @@ import { clusterViewURL } from "../cluster-manager/cluster-view.route";
|
|||||||
import { WorkspaceClusterMenu } from "./workspace-cluster-menu";
|
import { WorkspaceClusterMenu } from "./workspace-cluster-menu";
|
||||||
import { kebabCase } from "lodash";
|
import { kebabCase } from "lodash";
|
||||||
import { addClusterURL } from "../+add-cluster";
|
import { addClusterURL } from "../+add-cluster";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
workspace: Workspace;
|
workspace: Workspace;
|
||||||
}
|
}
|
||||||
@ -24,6 +23,12 @@ enum sortBy {
|
|||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class WorkspaceOverview extends Component<Props> {
|
export class WorkspaceOverview extends Component<Props> {
|
||||||
|
private workspaceClusterStore = new WorkspaceClusterStore(this.props.workspace.id);
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.workspaceClusterStore.loadAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
showCluster = ({ clusterId }: ClusterItem) => {
|
showCluster = ({ clusterId }: ClusterItem) => {
|
||||||
navigate(clusterViewURL({ params: { clusterId } }));
|
navigate(clusterViewURL({ params: { clusterId } }));
|
||||||
@ -31,18 +36,15 @@ export class WorkspaceOverview extends Component<Props> {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { workspace } = this.props;
|
const { workspace } = this.props;
|
||||||
const workspaceClusterStore = new WorkspaceClusterStore(workspace.id);
|
|
||||||
|
|
||||||
workspaceClusterStore.loadAll();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ItemListLayout
|
<ItemListLayout
|
||||||
renderHeaderTitle={<div>Clusters</div>}
|
renderHeaderTitle="Clusters"
|
||||||
isClusterScoped
|
isClusterScoped
|
||||||
isSearchable={false}
|
isSearchable={false}
|
||||||
isSelectable={false}
|
isSelectable={false}
|
||||||
className="WorkspaceOverview"
|
className="WorkspaceOverview"
|
||||||
store={workspaceClusterStore}
|
store={this.workspaceClusterStore}
|
||||||
sortingCallbacks={{
|
sortingCallbacks={{
|
||||||
[sortBy.name]: (item: ClusterItem) => item.name,
|
[sortBy.name]: (item: ClusterItem) => item.name,
|
||||||
[sortBy.distribution]: (item: ClusterItem) => item.distribution,
|
[sortBy.distribution]: (item: ClusterItem) => item.distribution,
|
||||||
@ -67,7 +69,7 @@ export class WorkspaceOverview extends Component<Props> {
|
|||||||
onAdd: () => navigate(addClusterURL()),
|
onAdd: () => navigate(addClusterURL()),
|
||||||
}}
|
}}
|
||||||
renderItemMenu={(clusterItem: ClusterItem) => (
|
renderItemMenu={(clusterItem: ClusterItem) => (
|
||||||
<WorkspaceClusterMenu clusterItem={clusterItem} workspace={workspace} workspaceClusterStore={workspaceClusterStore}/>
|
<WorkspaceClusterMenu clusterItem={clusterItem} workspace={workspace} workspaceClusterStore={this.workspaceClusterStore}/>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import { computed, observable } from "mobx";
|
|||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
|
|
||||||
import { userStore } from "../../../common/user-store";
|
import { userStore } from "../../../common/user-store";
|
||||||
|
import { isWindows } from "../../../common/vars";
|
||||||
import { appPreferenceRegistry } from "../../../extensions/registries/app-preference-registry";
|
import { appPreferenceRegistry } from "../../../extensions/registries/app-preference-registry";
|
||||||
import { themeStore } from "../../theme.store";
|
import { themeStore } from "../../theme.store";
|
||||||
import { Checkbox } from "../checkbox";
|
import { Checkbox } from "../checkbox";
|
||||||
@ -19,6 +20,7 @@ import { ScrollSpy } from "../scroll-spy/scroll-spy";
|
|||||||
@observer
|
@observer
|
||||||
export class Preferences extends React.Component {
|
export class Preferences extends React.Component {
|
||||||
@observable httpProxy = userStore.preferences.httpsProxy || "";
|
@observable httpProxy = userStore.preferences.httpsProxy || "";
|
||||||
|
@observable shell = userStore.preferences.shell || "";
|
||||||
|
|
||||||
@computed get themeOptions(): SelectOption<string>[] {
|
@computed get themeOptions(): SelectOption<string>[] {
|
||||||
return themeStore.themes.map(theme => ({
|
return themeStore.themes.map(theme => ({
|
||||||
@ -31,6 +33,15 @@ export class Preferences extends React.Component {
|
|||||||
const { preferences } = userStore;
|
const { preferences } = userStore;
|
||||||
const header = <h2>Preferences</h2>;
|
const header = <h2>Preferences</h2>;
|
||||||
const rootMargin = "80px 0px -85%"; // Cut header size from the top and 85% from the bottom of viewport
|
const rootMargin = "80px 0px -85%"; // Cut header size from the top and 85% from the bottom of viewport
|
||||||
|
let defaultShell = process.env.SHELL || process.env.PTYSHELL;
|
||||||
|
|
||||||
|
if (!defaultShell) {
|
||||||
|
if (isWindows) {
|
||||||
|
defaultShell = "powershell.exe";
|
||||||
|
} else {
|
||||||
|
defaultShell = "System default shell";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ScrollSpy rootMargin={rootMargin} render={navigation => (
|
<ScrollSpy rootMargin={rootMargin} render={navigation => (
|
||||||
@ -80,6 +91,20 @@ export class Preferences extends React.Component {
|
|||||||
Does not affect cluster communications!
|
Does not affect cluster communications!
|
||||||
</small>
|
</small>
|
||||||
</section>
|
</section>
|
||||||
|
<section id="shell">
|
||||||
|
<h2>Terminal Shell</h2>
|
||||||
|
<SubTitle title="Shell Path"/>
|
||||||
|
<Input
|
||||||
|
theme="round-black"
|
||||||
|
placeholder={defaultShell}
|
||||||
|
value={this.shell}
|
||||||
|
onChange={v => this.shell = v}
|
||||||
|
onBlur={() => preferences.shell = this.shell}
|
||||||
|
/>
|
||||||
|
<small className="hint">
|
||||||
|
The path of the shell that the terminal uses.
|
||||||
|
</small>
|
||||||
|
</section>
|
||||||
<section id="startup">
|
<section id="startup">
|
||||||
<h2>Start-up</h2>
|
<h2>Start-up</h2>
|
||||||
<SubTitle title="Automatic Start-up"/>
|
<SubTitle title="Automatic Start-up"/>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user