diff --git a/src/renderer/components/+cluster-settings/cluster-settings.scss b/src/renderer/components/+cluster-settings/cluster-settings.scss index d179889f12..dd1cd37f60 100644 --- a/src/renderer/components/+cluster-settings/cluster-settings.scss +++ b/src/renderer/components/+cluster-settings/cluster-settings.scss @@ -1,87 +1,51 @@ .ClusterSettings { - .WizardLayout { - grid-template-columns: unset; - grid-template-rows: 76px 1fr; - padding: 0; + $spacing: $padding * 3; - .head-col { - justify-content: space-between; + > .content-wrapper { + --flex-gap: #{$spacing}; + } - :nth-child(2) { - flex: 1 0 0; - } - } + // TODO: move sub-component styles to separate files + .admin-note { + font-size: small; + opacity: 0.5; + margin-left: $margin; + } - .content-col { - margin: 0; - padding-top: $padding * 3; - background-color: $clusterSettingsBackground; + .button-area { + margin-top: $margin * 2; + } - .SubTitle { - text-transform: none; - } + .file-loader { + margin-top: $margin * 2; + } - > div { - margin-top: $margin * 5; - } + .status-table { + margin: $spacing 0; - .admin-note { - font-size: small; - opacity: 0.5; - margin-left: $margin; - } + .Table { + border: 1px solid var(--drawerSubtitleBackground); + border-radius: $radius; - .button-area { - margin-top: $margin * 2; - } + .TableRow { + &:not(:last-of-type) { + border-bottom: 1px solid var(--drawerSubtitleBackground); + } - .file-loader { - margin-top: $margin * 2; - } + .value { + flex-grow: 2; + word-break: break-word; + color: var(--textColorSecondary); + } - .hint { - font-size: smaller; - opacity: 0.8; - } - - p + p, .hint + p { - padding-top: $padding; - } - } - - .status-table { - margin: $margin * 3 0; - - .Table { - border: 1px solid var(--drawerSubtitleBackground); - border-radius: $radius; - - .TableRow { - &:not(:last-of-type) { - border-bottom: 1px solid var(--drawerSubtitleBackground); - } - - .value { - flex-grow: 2; - word-break: break-word; - color: var(--textColorSecondary); - } - - .link { - @include pseudo-link; - } + .link { + @include pseudo-link; } } } + } - .Input, .Select { - margin-top: 10px; - } - - .Select { - &__control { - box-shadow: 0 0 0 1px $borderFaintColor; - } - } + .Input, .Select { + margin-top: $padding; } } \ No newline at end of file diff --git a/src/renderer/components/+cluster-settings/cluster-settings.tsx b/src/renderer/components/+cluster-settings/cluster-settings.tsx index 9558b26967..d92d48c321 100644 --- a/src/renderer/components/+cluster-settings/cluster-settings.tsx +++ b/src/renderer/components/+cluster-settings/cluster-settings.tsx @@ -1,21 +1,19 @@ import "./cluster-settings.scss"; import React from "react"; -import { observer, disposeOnUnmount } from "mobx-react"; +import { autorun } from "mobx"; +import { disposeOnUnmount, observer } from "mobx-react"; import { Features } from "./features"; import { Removal } from "./removal"; import { Status } from "./status"; import { General } from "./general"; import { Cluster } from "../../../main/cluster"; -import { WizardLayout } from "../layout/wizard-layout"; import { ClusterIcon } from "../cluster-icon"; -import { Icon } from "../icon"; -import { navigate } from "../../navigation"; import { IClusterSettingsRouteParams } from "./cluster-settings.route"; import { clusterStore } from "../../../common/cluster-store"; import { RouteComponentProps } from "react-router"; import { clusterIpc } from "../../../common/cluster-ipc"; -import { autorun } from "mobx"; +import { PageLayout } from "../layout/page-layout"; interface Props extends RouteComponentProps { } @@ -27,7 +25,6 @@ export class ClusterSettings extends React.Component { } async componentDidMount() { - window.addEventListener('keydown', this.onEscapeKey); disposeOnUnmount(this, autorun(() => { this.refreshCluster(); @@ -35,51 +32,29 @@ export class ClusterSettings extends React.Component { ) } - componentWillUnmount() { - window.removeEventListener('keydown', this.onEscapeKey); - } - - onEscapeKey = (evt: KeyboardEvent) => { - if (evt.code === "Escape") { - evt.stopPropagation(); - this.close(); - } - } - refreshCluster = async () => { - if(this.cluster) { + if (this.cluster) { await clusterIpc.activate.invokeFromRenderer(this.cluster.id); clusterIpc.refresh.invokeFromRenderer(this.cluster.id); } } - close() { - navigate("/"); - } - render() { const cluster = this.cluster if (!cluster) return null; const header = ( <> - +

{cluster.preferences.clusterName}

- ); return ( -
- - - - - - -
+ + + + + + ); } } diff --git a/src/renderer/components/+cluster-settings/components/cluster-home-dir-setting.tsx b/src/renderer/components/+cluster-settings/components/cluster-home-dir-setting.tsx index acb23da08a..965333d4db 100644 --- a/src/renderer/components/+cluster-settings/components/cluster-home-dir-setting.tsx +++ b/src/renderer/components/+cluster-settings/components/cluster-home-dir-setting.tsx @@ -41,10 +41,10 @@ export class ClusterHomeDirSetting extends React.Component { onBlur={this.save} placeholder="$HOME" /> - + An explicit start path where the terminal will be launched,{" "} this is used as the current working directory (cwd) for the shell process. - + ); } diff --git a/src/renderer/components/+cluster-settings/components/cluster-prometheus-setting.tsx b/src/renderer/components/+cluster-settings/components/cluster-prometheus-setting.tsx index a7f42a7c85..ff1f6fd62d 100644 --- a/src/renderer/components/+cluster-settings/components/cluster-prometheus-setting.tsx +++ b/src/renderer/components/+cluster-settings/components/cluster-prometheus-setting.tsx @@ -90,7 +90,7 @@ export class ClusterPrometheusSetting extends React.Component { }} options={options} /> - What query format is used to fetch metrics from Prometheus + What query format is used to fetch metrics from Prometheus {this.canEditPrometheusPath && ( <>

Prometheus service address.

@@ -101,10 +101,10 @@ export class ClusterPrometheusSetting extends React.Component { onBlur={this.onSavePath} placeholder="/:" /> - + An address to an existing Prometheus installation{" "} ({'/:'}). Lens tries to auto-detect address if left empty. - + )} diff --git a/src/renderer/components/+preferences/preferences.scss b/src/renderer/components/+preferences/preferences.scss index 62bd307cd1..7fd3a44445 100644 --- a/src/renderer/components/+preferences/preferences.scss +++ b/src/renderer/components/+preferences/preferences.scss @@ -1,60 +1,24 @@ .Preferences { - position: fixed!important; // Allows to cover ClustersMenu - z-index: 1; + $spacing: $padding * 2; - .WizardLayout { - grid-template-columns: unset; - grid-template-rows: 76px 1fr; - padding: 0; + .repos { + position: relative; - .content-col { - padding: $padding * 8 0; - background-color: $clusterSettingsBackground; - - h2 { - margin-bottom: $margin * 2; - - &:not(:first-child) { - margin-top: $margin * 3; - } - } - - .SubTitle { - text-transform: none; - margin: 0!important; - } - - .repos { - position: relative; - - .Badge { - display: flex; - margin: 0; - margin-bottom: 1px; - padding: $padding $padding * 2; - } - } - - .hint { - margin-top: -$margin; - } + .Badge { + display: flex; + margin: 0; + margin-bottom: 1px; + padding: $padding $spacing; } } - .is-mac & { - .WizardLayout .head-col { - padding-top: 32px; - overflow: hidden; - - .Icon { - margin-top: -$margin * 2; - } + .extensions { + h2 { + margin: $spacing 0; } - } - .Select { - &__control { - box-shadow: 0 0 0 1px $borderFaintColor; + &:empty { + display: none; } } } \ No newline at end of file diff --git a/src/renderer/components/+preferences/preferences.tsx b/src/renderer/components/+preferences/preferences.tsx index 18899bf563..adf8e51835 100644 --- a/src/renderer/components/+preferences/preferences.tsx +++ b/src/renderer/components/+preferences/preferences.tsx @@ -1,10 +1,10 @@ import "./preferences.scss" + import React from "react"; import { observer } from "mobx-react"; import { action, computed, observable } from "mobx"; import { t, Trans } from "@lingui/macro"; import { _i18n } from "../../i18n"; -import { WizardLayout } from "../layout/wizard-layout"; import { Icon } from "../icon"; import { Select, SelectOption } from "../select"; import { userStore } from "../../../common/user-store"; @@ -14,10 +14,10 @@ import { Checkbox } from "../checkbox"; import { Notifications } from "../notifications"; import { Badge } from "../badge"; import { themeStore } from "../../theme.store"; -import { history } from "../../navigation"; import { Tooltip } from "../tooltip"; import { KubectlBinaries } from "./kubectl-binaries"; import { appPreferenceRegistry } from "../../../extensions/app-preference-registry"; +import { PageLayout } from "../layout/page-layout"; @observer export class Preferences extends React.Component { @@ -41,21 +41,9 @@ export class Preferences extends React.Component { } async componentDidMount() { - window.addEventListener('keydown', this.onEscapeKey); await this.loadHelmRepos(); } - componentWillUnmount() { - window.removeEventListener('keydown', this.onEscapeKey); - } - - onEscapeKey = (evt: KeyboardEvent) => { - if (evt.code === "Escape") { - evt.stopPropagation(); - history.goBack(); - } - } - @action async loadHelmRepos() { this.helmLoading = true; @@ -115,91 +103,86 @@ export class Preferences extends React.Component { render() { const { preferences } = userStore; - const extensionPreferences = appPreferenceRegistry.preferences - const header = ( - <> -

Preferences

- - - ); + const extensionPreferences = appPreferenceRegistry.preferences; + const header =

Preferences

; return ( -
- -

Color Theme

- preferences.colorTheme = value} + /> -

HTTP Proxy

- this.httpProxy = v} - onBlur={() => preferences.httpsProxy = this.httpProxy} - /> - - Proxy is used only for non-cluster communication. - +

HTTP Proxy

+ this.httpProxy = v} + onBlur={() => preferences.httpsProxy = this.httpProxy} + /> + + Proxy is used only for non-cluster communication. + - + -

Helm

- Repositories} + isLoading={this.helmLoading} + isDisabled={this.helmLoading} + options={this.helmOptions} + onChange={this.onRepoSelect} + formatOptionLabel={this.formatHelmOptionLabel} + controlShouldRenderValue={false} + /> +
+ {Array.from(this.helmAddedRepos).map(([name, repo]) => { + const tooltipId = `message-${name}`; return ( -
+ + {name} + this.removeRepo(repo)} + tooltip={Remove} + /> + + {repo.url} + + + ) + })} +
+ +

Certificate Trust

+ Allow untrusted Certificate Authorities} + value={preferences.allowUntrustedCAs} + onChange={v => 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! + + +
+ {extensionPreferences.map(({ title, components: { Hint, Input } }, index) => { + return ( +

{title}

- + - +
) })} - -
+
+ ); } } diff --git a/src/renderer/components/+support/support.tsx b/src/renderer/components/+support/support.tsx index 1859173b43..61f5a102bd 100644 --- a/src/renderer/components/+support/support.tsx +++ b/src/renderer/components/+support/support.tsx @@ -10,7 +10,7 @@ import { PageLayout } from "../layout/page-layout"; export class Support extends React.Component { render() { return ( - Support}> + Support}>

Community Slack Channel

Ask a question, see what's being discussed, join the conversation here{" "} diff --git a/src/renderer/components/layout/page-layout.scss b/src/renderer/components/layout/page-layout.scss index 2616a922ab..53268f948f 100644 --- a/src/renderer/components/layout/page-layout.scss +++ b/src/renderer/components/layout/page-layout.scss @@ -6,21 +6,21 @@ display: grid !important; grid-template-rows: min-content 1fr; - // global page, covers whole app screen - &.global { + // covers whole app view area + &.top { position: fixed !important; // allow to cover ClustersMenu z-index: 1; + + // adds extra space for traffic-light top buttons (mac only) + .is-mac & > .header { + padding-top: $spacing * 2; + } } > .header { position: sticky; padding: $spacing; background-color: $layoutTabsBackground; - - // add extra spacing for traffic-light top buttons (mac only) - .is-mac & { - padding-top: $spacing * 2; - } } > .content-wrapper { @@ -47,6 +47,15 @@ color: $colorInfo; } + .SubTitle { + text-transform: none; + margin-bottom: 0 !important; + + + * + .hint { + margin-top: -$padding / 2; + } + } + .Select { &__control { box-shadow: 0 0 0 1px $borderFaintColor; diff --git a/src/renderer/components/layout/page-layout.tsx b/src/renderer/components/layout/page-layout.tsx index 5cfe5bad50..b22470c436 100644 --- a/src/renderer/components/layout/page-layout.tsx +++ b/src/renderer/components/layout/page-layout.tsx @@ -2,7 +2,7 @@ import "./page-layout.scss" import React from "react"; import { observer } from "mobx-react"; -import { cssNames, IClassName } from "../../utils"; +import { autobind, cssNames, IClassName } from "../../utils"; import { Icon } from "../icon"; import { navigation } from "../../navigation"; @@ -13,7 +13,8 @@ export interface PageLayoutProps extends React.DOMAttributes { contentClass?: IClassName; provideBackButtonNavigation?: boolean; contentGaps?: boolean; - fullScreen?: boolean; // covers whole app view + showOnTop?: boolean; // covers whole app view + back?: (evt: React.MouseEvent | KeyboardEvent) => void; } const defaultProps: Partial = { @@ -25,7 +26,14 @@ const defaultProps: Partial = { export class PageLayout extends React.Component { static defaultProps = defaultProps as object; - back = () => navigation.goBack(); + @autobind() + back(evt?: React.MouseEvent | KeyboardEvent) { + if (this.props.back) { + this.props.back(evt); + } else { + navigation.goBack(); + } + } async componentDidMount() { window.addEventListener('keydown', this.onEscapeKey); @@ -41,17 +49,18 @@ export class PageLayout extends React.Component { } if (evt.code === "Escape") { evt.stopPropagation(); - this.back(); + this.back(evt); } } render() { const { - className, contentClass, header, headerClass, provideBackButtonNavigation, - contentGaps, fullScreen, children, ...elemProps + contentClass, header, headerClass, provideBackButtonNavigation, + contentGaps, showOnTop, children, ...elemProps } = this.props; + const className = cssNames("PageLayout", { top: showOnTop }, this.props.className); return ( -

+
{header} {provideBackButtonNavigation && (