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 {
|
||||
httpsProxy?: string;
|
||||
shell?: string;
|
||||
colorTheme?: string;
|
||||
allowUntrustedCAs?: boolean;
|
||||
allowTelemetry?: boolean;
|
||||
|
||||
@ -252,7 +252,7 @@ export class Cluster implements ClusterModel, ClusterState {
|
||||
* Kubernetes version
|
||||
*/
|
||||
get version(): string {
|
||||
return String(this.metadata?.version || "");
|
||||
return String(this.metadata?.version ?? "");
|
||||
}
|
||||
|
||||
constructor(model: ClusterModel) {
|
||||
|
||||
@ -105,10 +105,11 @@ export class ShellSession extends EventEmitter {
|
||||
protected async getShellEnv() {
|
||||
const env = JSON.parse(JSON.stringify(await shellEnv()));
|
||||
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) {
|
||||
env["SystemRoot"] = process.env.SystemRoot;
|
||||
env["PTYSHELL"] = process.env.SHELL || "powershell.exe";
|
||||
env["PTYSHELL"] = shell || "powershell.exe";
|
||||
env["PATH"] = pathStr;
|
||||
env["LENS_SESSION"] = "true";
|
||||
const lensWslEnv = "KUBECONFIG/up:LENS_SESSION/u";
|
||||
@ -118,8 +119,8 @@ export class ShellSession extends EventEmitter {
|
||||
} else {
|
||||
env["WSLENV"] = lensWslEnv;
|
||||
}
|
||||
} else if(typeof(process.env.SHELL) != "undefined") {
|
||||
env["PTYSHELL"] = process.env.SHELL;
|
||||
} else if(shell !== undefined) {
|
||||
env["PTYSHELL"] = shell;
|
||||
env["PATH"] = pathStr;
|
||||
} else {
|
||||
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 { kebabCase } from "lodash";
|
||||
import { addClusterURL } from "../+add-cluster";
|
||||
|
||||
interface Props {
|
||||
workspace: Workspace;
|
||||
}
|
||||
@ -24,6 +23,12 @@ enum sortBy {
|
||||
|
||||
@observer
|
||||
export class WorkspaceOverview extends Component<Props> {
|
||||
private workspaceClusterStore = new WorkspaceClusterStore(this.props.workspace.id);
|
||||
|
||||
componentDidMount() {
|
||||
this.workspaceClusterStore.loadAll();
|
||||
}
|
||||
|
||||
|
||||
showCluster = ({ clusterId }: ClusterItem) => {
|
||||
navigate(clusterViewURL({ params: { clusterId } }));
|
||||
@ -31,18 +36,15 @@ export class WorkspaceOverview extends Component<Props> {
|
||||
|
||||
render() {
|
||||
const { workspace } = this.props;
|
||||
const workspaceClusterStore = new WorkspaceClusterStore(workspace.id);
|
||||
|
||||
workspaceClusterStore.loadAll();
|
||||
|
||||
return (
|
||||
<ItemListLayout
|
||||
renderHeaderTitle={<div>Clusters</div>}
|
||||
renderHeaderTitle="Clusters"
|
||||
isClusterScoped
|
||||
isSearchable={false}
|
||||
isSelectable={false}
|
||||
className="WorkspaceOverview"
|
||||
store={workspaceClusterStore}
|
||||
store={this.workspaceClusterStore}
|
||||
sortingCallbacks={{
|
||||
[sortBy.name]: (item: ClusterItem) => item.name,
|
||||
[sortBy.distribution]: (item: ClusterItem) => item.distribution,
|
||||
@ -67,7 +69,7 @@ export class WorkspaceOverview extends Component<Props> {
|
||||
onAdd: () => navigate(addClusterURL()),
|
||||
}}
|
||||
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 { 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";
|
||||
@ -19,6 +20,7 @@ import { ScrollSpy } from "../scroll-spy/scroll-spy";
|
||||
@observer
|
||||
export class Preferences extends React.Component {
|
||||
@observable httpProxy = userStore.preferences.httpsProxy || "";
|
||||
@observable shell = userStore.preferences.shell || "";
|
||||
|
||||
@computed get themeOptions(): SelectOption<string>[] {
|
||||
return themeStore.themes.map(theme => ({
|
||||
@ -31,6 +33,15 @@ export class Preferences extends React.Component {
|
||||
const { preferences } = userStore;
|
||||
const header = <h2>Preferences</h2>;
|
||||
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 (
|
||||
<ScrollSpy rootMargin={rootMargin} render={navigation => (
|
||||
@ -80,6 +91,20 @@ export class Preferences extends React.Component {
|
||||
Does not affect cluster communications!
|
||||
</small>
|
||||
</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">
|
||||
<h2>Start-up</h2>
|
||||
<SubTitle title="Automatic Start-up"/>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user