mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Preferences section restyling (#700)
* Adding 'centering' option to WizardLayout Signed-off-by: alexfront <alex.andreev.email@gmail.com> * Using centered layout in Cluster Settings Signed-off-by: alexfront <alex.andreev.email@gmail.com> * Restyling Preferences section Signed-off-by: alexfront <alex.andreev.email@gmail.com> * Simplifying Helm loading state Signed-off-by: alexfront <alex.andreev.email@gmail.com>
This commit is contained in:
parent
da96776b73
commit
405163adbe
@ -1,6 +1,7 @@
|
|||||||
.ClusterSettings {
|
.ClusterSettings {
|
||||||
.WizardLayout {
|
.WizardLayout {
|
||||||
grid-template-columns: unset;
|
grid-template-columns: unset;
|
||||||
|
grid-template-rows: 76px 1fr;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
||||||
.head-col {
|
.head-col {
|
||||||
@ -9,15 +10,6 @@
|
|||||||
:nth-child(2) {
|
:nth-child(2) {
|
||||||
flex: 1 0 0;
|
flex: 1 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
|
||||||
text-decoration: none;
|
|
||||||
color: $grey-600;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-col {
|
|
||||||
display: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.content-col {
|
.content-col {
|
||||||
@ -29,25 +21,18 @@
|
|||||||
text-transform: none;
|
text-transform: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.settings-wrapper {
|
> div {
|
||||||
margin: 0 auto;
|
margin-top: $margin * 5;
|
||||||
width: 60%;
|
}
|
||||||
min-width: 570px;
|
|
||||||
max-width: 1000px;
|
|
||||||
|
|
||||||
> div {
|
.admin-note {
|
||||||
margin-top: $margin * 5;
|
font-size: small;
|
||||||
}
|
opacity: 0.5;
|
||||||
|
margin-left: $margin;
|
||||||
|
}
|
||||||
|
|
||||||
.admin-note {
|
.button-area {
|
||||||
font-size: small;
|
margin-top: $margin * 2;
|
||||||
opacity: 0.5;
|
|
||||||
margin-left: $margin;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button-area {
|
|
||||||
margin-top: $margin * 2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.file-loader {
|
.file-loader {
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import "./cluster-settings.scss";
|
import "./cluster-settings.scss";
|
||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { Link } from "react-router-dom";
|
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import { Features } from "./features";
|
import { Features } from "./features";
|
||||||
import { Removal } from "./removal";
|
import { Removal } from "./removal";
|
||||||
@ -11,6 +10,7 @@ import { WizardLayout } from "../layout/wizard-layout";
|
|||||||
import { ClusterIcon } from "../cluster-icon";
|
import { ClusterIcon } from "../cluster-icon";
|
||||||
import { Icon } from "../icon";
|
import { Icon } from "../icon";
|
||||||
import { getMatchedCluster } from "../cluster-manager/cluster-view.route";
|
import { getMatchedCluster } from "../cluster-manager/cluster-view.route";
|
||||||
|
import { navigate } from "../../navigation";
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class ClusterSettings extends React.Component {
|
export class ClusterSettings extends React.Component {
|
||||||
@ -25,20 +25,16 @@ export class ClusterSettings extends React.Component {
|
|||||||
showTooltip={false}
|
showTooltip={false}
|
||||||
/>
|
/>
|
||||||
<h2>{cluster.preferences.clusterName}</h2>
|
<h2>{cluster.preferences.clusterName}</h2>
|
||||||
<Link to="/">
|
<Icon material="close" onClick={() => navigate("/")} big/>
|
||||||
<Icon material="close" big/>
|
|
||||||
</Link>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<div className="ClusterSettings">
|
<div className="ClusterSettings">
|
||||||
<WizardLayout header={header}>
|
<WizardLayout header={header} centered>
|
||||||
<div className="settings-wrapper">
|
<Status cluster={cluster}></Status>
|
||||||
<Status cluster={cluster}></Status>
|
<General cluster={cluster}></General>
|
||||||
<General cluster={cluster}></General>
|
<Features cluster={cluster}></Features>
|
||||||
<Features cluster={cluster}></Features>
|
<Removal cluster={cluster}></Removal>
|
||||||
<Removal cluster={cluster}></Removal>
|
|
||||||
</div>
|
|
||||||
</WizardLayout>
|
</WizardLayout>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,23 +1,51 @@
|
|||||||
.Preferences {
|
.Preferences {
|
||||||
h2 {
|
position: fixed!important; // Allows to cover ClustersMenu
|
||||||
&:not(:first-child) {
|
z-index: 1;
|
||||||
margin-top: $padding * 3;
|
|
||||||
|
.WizardLayout {
|
||||||
|
grid-template-columns: unset;
|
||||||
|
grid-template-rows: 76px 1fr;
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
.content-col {
|
||||||
|
background-color: transparent;
|
||||||
|
padding: $padding * 8 0;
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
margin-bottom: $margin * 2;
|
||||||
|
|
||||||
|
&:not(:first-child) {
|
||||||
|
margin-top: $margin * 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.repos {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.Badge {
|
||||||
|
display: flex;
|
||||||
|
margin: 0;
|
||||||
|
margin-bottom: 1px;
|
||||||
|
padding: $padding $padding * 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.hint {
|
||||||
|
margin-top: -$margin;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-block {
|
.is-mac & {
|
||||||
--flex-gap: #{$padding};
|
.WizardLayout .head-col {
|
||||||
|
padding-top: 32px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.repos {
|
.Select {
|
||||||
--flex-gap: #{$padding};
|
&__control {
|
||||||
|
box-shadow: 0 0 0 1px $borderFaintColor;
|
||||||
> .title {
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
|
|
||||||
.Badge {
|
|
||||||
margin: $padding / 2;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,5 +1,5 @@
|
|||||||
import "./preferences.scss"
|
import "./preferences.scss"
|
||||||
import React, { Fragment } from "react";
|
import React from "react";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import { action, computed, observable } from "mobx";
|
import { action, computed, observable } from "mobx";
|
||||||
import { t, Trans } from "@lingui/macro";
|
import { t, Trans } from "@lingui/macro";
|
||||||
@ -15,11 +15,12 @@ import { Notifications } from "../notifications";
|
|||||||
import { Badge } from "../badge";
|
import { Badge } from "../badge";
|
||||||
import { Spinner } from "../spinner";
|
import { Spinner } from "../spinner";
|
||||||
import { themeStore } from "../../theme.store";
|
import { themeStore } from "../../theme.store";
|
||||||
|
import { history } from "../../navigation";
|
||||||
|
import { Tooltip } from "../tooltip";
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class Preferences extends React.Component {
|
export class Preferences extends React.Component {
|
||||||
@observable helmLoading = false;
|
@observable helmLoading = false;
|
||||||
@observable helmUpdating = false;
|
|
||||||
@observable helmRepos: HelmRepo[] = [];
|
@observable helmRepos: HelmRepo[] = [];
|
||||||
@observable helmAddedRepos = observable.map<string, HelmRepo>();
|
@observable helmAddedRepos = observable.map<string, HelmRepo>();
|
||||||
|
|
||||||
@ -88,9 +89,9 @@ export class Preferences extends React.Component {
|
|||||||
Notifications.ok(<Trans>Helm branch <b>{repo.name}</b> already in use</Trans>)
|
Notifications.ok(<Trans>Helm branch <b>{repo.name}</b> already in use</Trans>)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.helmUpdating = false;
|
this.helmLoading = true;
|
||||||
await this.addRepo(repo);
|
await this.addRepo(repo);
|
||||||
this.helmUpdating = false;
|
this.helmLoading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
formatHelmOptionLabel = ({ value: repo }: SelectOption<HelmRepo>) => {
|
formatHelmOptionLabel = ({ value: repo }: SelectOption<HelmRepo>) => {
|
||||||
@ -103,104 +104,96 @@ export class Preferences extends React.Component {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
renderInfo() {
|
|
||||||
return (
|
|
||||||
<Fragment>
|
|
||||||
<h2>
|
|
||||||
<Trans>Preferences</Trans>
|
|
||||||
</h2>
|
|
||||||
<div className="info-block flex gaps align-flex-start">
|
|
||||||
<Icon small material="info"/>
|
|
||||||
<p>
|
|
||||||
<Trans>Lens Global Settings</Trans> (<Trans>applicable to all clusters</Trans>)
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</Fragment>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { preferences } = userStore;
|
const { preferences } = userStore;
|
||||||
|
const header = (
|
||||||
|
<>
|
||||||
|
<h2>Preferences</h2>
|
||||||
|
<Icon material="close" big onClick={history.goBack}/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
return (
|
return (
|
||||||
<WizardLayout className="Preferences" infoPanel={this.renderInfo()}>
|
<div className="Preferences">
|
||||||
<h2><Trans>Color Theme</Trans></h2>
|
<WizardLayout header={header} centered>
|
||||||
<Select
|
<h2><Trans>Color Theme</Trans></h2>
|
||||||
options={this.themeOptions}
|
<Select
|
||||||
value={preferences.colorTheme}
|
options={this.themeOptions}
|
||||||
onChange={({ value }: SelectOption) => preferences.colorTheme = value}
|
value={preferences.colorTheme}
|
||||||
/>
|
onChange={({ value }: SelectOption) => preferences.colorTheme = value}
|
||||||
|
/>
|
||||||
|
|
||||||
<h2><Trans>Download Mirror</Trans></h2>
|
<h2><Trans>Download Mirror</Trans></h2>
|
||||||
<Select
|
<Select
|
||||||
placeholder={<Trans>Download mirror for kubectl</Trans>}
|
placeholder={<Trans>Download mirror for kubectl</Trans>}
|
||||||
options={this.downloadMirrorOptions}
|
options={this.downloadMirrorOptions}
|
||||||
value={preferences.downloadMirror}
|
value={preferences.downloadMirror}
|
||||||
onChange={({ value }: SelectOption) => preferences.downloadMirror = value}
|
onChange={({ value }: SelectOption) => preferences.downloadMirror = value}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<h2><Trans>Helm</Trans></h2>
|
<h2><Trans>Helm</Trans></h2>
|
||||||
<Select
|
<Select
|
||||||
placeholder={<Trans>Repositories</Trans>}
|
placeholder={<Trans>Repositories</Trans>}
|
||||||
isLoading={this.helmLoading}
|
isLoading={this.helmLoading}
|
||||||
isDisabled={this.helmUpdating}
|
isDisabled={this.helmLoading}
|
||||||
options={this.helmOptions}
|
options={this.helmOptions}
|
||||||
onChange={this.onRepoSelect}
|
onChange={this.onRepoSelect}
|
||||||
formatOptionLabel={this.formatHelmOptionLabel}
|
formatOptionLabel={this.formatHelmOptionLabel}
|
||||||
controlShouldRenderValue={false}
|
controlShouldRenderValue={false}
|
||||||
/>
|
/>
|
||||||
<div className="repos flex gaps align-center">
|
<div className="repos flex gaps column">
|
||||||
<div className="title">
|
|
||||||
<Trans>Added repos:</Trans>
|
|
||||||
</div>
|
|
||||||
<div className="repos-list">
|
|
||||||
{this.helmLoading && <Spinner/>}
|
|
||||||
{Array.from(this.helmAddedRepos).map(([name, repo]) => {
|
{Array.from(this.helmAddedRepos).map(([name, repo]) => {
|
||||||
|
const tooltipId = `message-${name}`;
|
||||||
return (
|
return (
|
||||||
<Badge key={name} className="added-repo flex gaps align-center" title={repo.url}>
|
<Badge key={name} className="added-repo flex gaps align-center justify-space-between">
|
||||||
<span className="repo">{name}</span>
|
<span id={tooltipId} className="repo">{name}</span>
|
||||||
<Icon
|
<Icon
|
||||||
material="remove_circle_outline"
|
material="delete"
|
||||||
onClick={() => this.removeRepo(repo)}
|
onClick={() => this.removeRepo(repo)}
|
||||||
tooltip={<Trans>Remove</Trans>}
|
tooltip={<Trans>Remove</Trans>}
|
||||||
/>
|
/>
|
||||||
|
<Tooltip targetId={tooltipId} formatters={{ narrow: true }}>
|
||||||
|
{repo.url}
|
||||||
|
</Tooltip>
|
||||||
</Badge>
|
</Badge>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<h2><Trans>HTTP Proxy</Trans></h2>
|
<h2><Trans>HTTP Proxy</Trans></h2>
|
||||||
<Input
|
<Input
|
||||||
placeholder={_i18n._(t`Type HTTP proxy url (example: http://proxy.acme.org:8080)`)}
|
theme="round-black"
|
||||||
value={preferences.httpsProxy || ""}
|
placeholder={_i18n._(t`Type HTTP proxy url (example: http://proxy.acme.org:8080)`)}
|
||||||
onChange={v => preferences.httpsProxy = v}
|
value={preferences.httpsProxy || ""}
|
||||||
/>
|
onChange={v => preferences.httpsProxy = v}
|
||||||
<small className="hint">
|
/>
|
||||||
<Trans>Proxy is used only for non-cluster communication.</Trans>
|
<small className="hint">
|
||||||
</small>
|
<Trans>Proxy is used only for non-cluster communication.</Trans>
|
||||||
|
</small>
|
||||||
|
|
||||||
<h2><Trans>Certificate Trust</Trans></h2>
|
<h2><Trans>Certificate Trust</Trans></h2>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
label={<Trans>Allow untrusted Certificate Authorities</Trans>}
|
label={<Trans>Allow untrusted Certificate Authorities</Trans>}
|
||||||
value={preferences.allowUntrustedCAs}
|
value={preferences.allowUntrustedCAs}
|
||||||
onChange={v => preferences.allowUntrustedCAs = v}
|
onChange={v => preferences.allowUntrustedCAs = v}
|
||||||
/>
|
/>
|
||||||
<small className="hint">
|
<small className="hint">
|
||||||
<Trans>This will make Lens to trust ANY certificate authority without any validations.</Trans>{" "}
|
<Trans>This will make Lens to trust ANY certificate authority without any validations.</Trans>{" "}
|
||||||
<Trans>Needed with some corporate proxies that do certificate re-writing.</Trans>{" "}
|
<Trans>Needed with some corporate proxies that do certificate re-writing.</Trans>{" "}
|
||||||
<Trans>Does not affect cluster communications!</Trans>
|
<Trans>Does not affect cluster communications!</Trans>
|
||||||
</small>
|
</small>
|
||||||
|
|
||||||
<h2><Trans>Telemetry & Usage Tracking</Trans></h2>
|
<h2><Trans>Telemetry & Usage Tracking</Trans></h2>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
label={<Trans>Allow telemetry & usage tracking</Trans>}
|
label={<Trans>Allow telemetry & usage tracking</Trans>}
|
||||||
value={preferences.allowTelemetry}
|
value={preferences.allowTelemetry}
|
||||||
onChange={v => preferences.allowTelemetry = v}
|
onChange={v => preferences.allowTelemetry = v}
|
||||||
/>
|
/>
|
||||||
<small className="hint">
|
<small className="hint">
|
||||||
<Trans>Telemetry & usage data is collected to continuously improve the Lens experience.</Trans>
|
<Trans>Telemetry & usage data is collected to continuously improve the Lens experience.</Trans>
|
||||||
</small>
|
</small>
|
||||||
</WizardLayout>
|
</WizardLayout>
|
||||||
)
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
> .head-col {
|
> .head-col {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
border-bottom: 1px solid $grey-800;
|
border-bottom: 1px solid $grey-800;
|
||||||
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
|
||||||
> .content-col {
|
> .content-col {
|
||||||
@ -41,4 +42,17 @@
|
|||||||
a {
|
a {
|
||||||
color: $colorInfo;
|
color: $colorInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.centered {
|
||||||
|
.content-col {
|
||||||
|
margin: 0;
|
||||||
|
|
||||||
|
> div {
|
||||||
|
margin: 0 auto;
|
||||||
|
width: 60%;
|
||||||
|
min-width: 570px;
|
||||||
|
max-width: 1000px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -10,25 +10,30 @@ interface Props {
|
|||||||
contentClass?: IClassName;
|
contentClass?: IClassName;
|
||||||
infoPanelClass?: IClassName;
|
infoPanelClass?: IClassName;
|
||||||
infoPanel?: React.ReactNode;
|
infoPanel?: React.ReactNode;
|
||||||
|
centered?: boolean; // Centering content horizontally
|
||||||
}
|
}
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class WizardLayout extends React.Component<Props> {
|
export class WizardLayout extends React.Component<Props> {
|
||||||
render() {
|
render() {
|
||||||
const { className, contentClass, infoPanelClass, infoPanel, header, headerClass, children: content } = this.props;
|
const { className, contentClass, infoPanelClass, infoPanel, header, headerClass, centered, children: content } = this.props;
|
||||||
return (
|
return (
|
||||||
<div className={cssNames("WizardLayout", className)}>
|
<div className={cssNames("WizardLayout", { centered }, className)}>
|
||||||
{header && (
|
{header && (
|
||||||
<div className={cssNames("head-col flex gaps align-center", headerClass)}>
|
<div className={cssNames("head-col flex gaps align-center", headerClass)}>
|
||||||
{header}
|
{header}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className={cssNames("content-col flex column gaps", contentClass)}>
|
<div className={cssNames("content-col flex column gaps", contentClass)}>
|
||||||
{content}
|
<div className="flex column gaps">
|
||||||
</div>
|
{content}
|
||||||
<div className={cssNames("info-col flex column gaps", infoPanelClass)}>
|
</div>
|
||||||
{infoPanel}
|
|
||||||
</div>
|
</div>
|
||||||
|
{infoPanel && (
|
||||||
|
<div className={cssNames("info-col flex column gaps", infoPanelClass)}>
|
||||||
|
{infoPanel}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,7 +23,7 @@ html {
|
|||||||
&--is-disabled {
|
&--is-disabled {
|
||||||
opacity: .75;
|
opacity: .75;
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
pointer-events: auto;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__control {
|
&__control {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user