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

Fine-tuning general section

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2021-06-22 13:30:37 +03:00
parent d6b641ce61
commit 9a3c3ad1ce
7 changed files with 33 additions and 28 deletions

View File

@ -45,6 +45,7 @@ import { Install } from "./install";
import { InstalledExtensions } from "./installed-extensions"; import { InstalledExtensions } from "./installed-extensions";
import { Notice } from "./notice"; import { Notice } from "./notice";
import { SettingLayout } from "../layout/setting-layout"; import { SettingLayout } from "../layout/setting-layout";
import { docsUrl } from "../../../common/vars";
function getMessageFromError(error: any): string { function getMessageFromError(error: any): string {
if (!error || typeof error !== "object") { if (!error || typeof error !== "object") {
@ -514,7 +515,13 @@ export class Extensions extends React.Component<Props> {
<section> <section>
<h1>Extensions</h1> <h1>Extensions</h1>
<Notice/> <Notice>
<p>
Add new features via Lens Extensions.{" "}
Check out <a href={`${docsUrl}/extensions/`} target="_blank" rel="noreferrer">docs</a>{" "}
and list of <a href="https://github.com/lensapp/lens-extensions/blob/main/README.md" target="_blank" rel="noreferrer">available extensions</a>.
</p>
</Notice>
<Install <Install
supportedFormats={supportedFormats} supportedFormats={supportedFormats}

View File

@ -20,17 +20,14 @@
*/ */
import styles from "./notice.module.css"; import styles from "./notice.module.css";
import React from "react"; import React, { DOMAttributes } from "react";
import { docsUrl } from "../../../common/vars";
export function Notice() { interface Props extends DOMAttributes<any> {}
export function Notice(props: Props) {
return ( return (
<div className={styles.notice}> <div className={styles.notice}>
<p> {props.children}
Add new features via Lens Extensions.{" "}
Check out <a href={`${docsUrl}/extensions/`} target="_blank" rel="noreferrer">docs</a>{" "}
and list of <a href="https://github.com/lensapp/lens-extensions/blob/main/README.md" target="_blank" rel="noreferrer">available extensions</a>.
</p>
</div> </div>
); );
} }

View File

@ -39,12 +39,17 @@ export function GeneralSettings({ entity }: EntitySettingViewProps) {
return ( return (
<section> <section>
<section className="small">
<p>General Cluster settings.</p>
</section>
<section> <section>
<components.ClusterNameSetting cluster={cluster} /> <components.ClusterNameSetting cluster={cluster} />
</section> </section>
<hr/>
<section> <section>
<components.ClusterIconSetting cluster={cluster} entity={entity as KubernetesCluster} /> <components.ClusterIconSetting cluster={cluster} entity={entity as KubernetesCluster} />
</section> </section>
<hr/>
<section> <section>
<components.ClusterKubeconfig cluster={cluster} /> <components.ClusterKubeconfig cluster={cluster} />
</section> </section>

View File

@ -21,7 +21,6 @@
import React from "react"; import React from "react";
import type { Cluster } from "../../../../main/cluster"; import type { Cluster } from "../../../../main/cluster";
//import { FilePicker, OverSizeLimitStyle } from "../../file-picker";
import { boundMethod } from "../../../utils"; import { boundMethod } from "../../../utils";
import { Button } from "../../button"; import { Button } from "../../button";
import { observable } from "mobx"; import { observable } from "mobx";
@ -67,15 +66,12 @@ export class ClusterIconSetting extends React.Component<Props> {
} }
getClearButton() { getClearButton() {
if (this.props.cluster.preferences.icon) { return <Button
return <Button label="Clear"
label="Clear" onClick={() => this.onIconPick([])}
tooltip="Revert back to default icon" disabled={!this.props.cluster.preferences.icon}
onClick={() => this.onIconPick([])} className="ml-5"
/>; />;
}
return null;
} }
render() { render() {
@ -87,15 +83,16 @@ export class ClusterIconSetting extends React.Component<Props> {
title={entity.metadata.name} title={entity.metadata.name}
source={entity.metadata.source} source={entity.metadata.source}
src={entity.spec.icon?.src} src={entity.spec.icon?.src}
size={50}
/> />
<span style={{marginRight: "var(--unit)"}}>Browse for new icon...</span> <Button className="ml-5">Upload Icon</Button>
</> </>
); );
return ( return (
<> <>
<SubTitle title="Cluster Icon" /> <SubTitle title="Cluster Icon" />
<div className="file-loader"> <div className="file-loader flex flex-row items-center mt-2">
<FilePicker <FilePicker
accept="image/*" accept="image/*"
label={label} label={label}

View File

@ -25,6 +25,7 @@ import { observer } from "mobx-react";
import { SubTitle } from "../../layout/sub-title"; import { SubTitle } from "../../layout/sub-title";
import { boundMethod } from "../../../../common/utils"; import { boundMethod } from "../../../../common/utils";
import { shell } from "electron"; import { shell } from "electron";
import { Notice } from "../../+extensions/notice";
interface Props { interface Props {
cluster: Cluster; cluster: Cluster;
@ -42,14 +43,12 @@ export class ClusterKubeconfig extends React.Component<Props> {
render() { render() {
return ( return (
<> <Notice>
<SubTitle title="Kubeconfig" /> <SubTitle title="Kubeconfig" />
<span> <span>
<a className="link value" onClick={this.openKubeconfig}>{this.props.cluster.kubeConfigPath}</a> <a className="link value" onClick={this.openKubeconfig}>{this.props.cluster.kubeConfigPath}</a>
</span> </span>
</Notice>
</>
); );
} }
} }

View File

@ -227,12 +227,12 @@ export class FilePicker extends React.Component<Props> {
getIconRight(): React.ReactNode { getIconRight(): React.ReactNode {
switch (this.status) { switch (this.status) {
case FileInputStatus.CLEAR:
return <Icon className="clean" material="cloud_upload"></Icon>;
case FileInputStatus.PROCESSING: case FileInputStatus.PROCESSING:
return <Spinner />; return <Spinner />;
case FileInputStatus.ERROR: case FileInputStatus.ERROR:
return <Icon material="error" title={this.errorText}></Icon>; return <Icon material="error" title={this.errorText}></Icon>;
default:
return null;
} }
} }
} }

View File

@ -163,7 +163,7 @@
} }
.Icon { .Icon {
color: var(--textColorSecondary); color: var(--textColorTertiary);
} }
} }