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

Making inputs consistent

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2021-06-21 16:50:34 +03:00
parent e2e3e371a8
commit 90c67f9a16
8 changed files with 45 additions and 40 deletions

View File

@ -106,6 +106,7 @@ export function MetricsSettings({ entity }: EntitySettingViewProps) {
<section> <section>
<components.ClusterPrometheusSetting cluster={cluster} /> <components.ClusterPrometheusSetting cluster={cluster} />
</section> </section>
<hr/>
<section> <section>
<components.ClusterMetricsSetting cluster={cluster} /> <components.ClusterMetricsSetting cluster={cluster} />
</section> </section>

View File

@ -54,6 +54,7 @@ export class ClusterAccessibleNamespaces extends React.Component<Props> {
this.namespaces.delete(oldNamesapce); this.namespaces.delete(oldNamesapce);
this.props.cluster.accessibleNamespaces = Array.from(this.namespaces); this.props.cluster.accessibleNamespaces = Array.from(this.namespaces);
}} }}
inputTheme="round-black"
/> />
<small className="hint"> <small className="hint">
This setting is useful for manually specifying which namespaces you have access to. This is useful when you do not have permissions to list namespaces. This setting is useful for manually specifying which namespaces you have access to. This is useful when you do not have permissions to list namespaces.

View File

@ -100,6 +100,7 @@ export class ClusterMetricsSetting extends React.Component<Props> {
options={Object.values(ClusterMetricsResourceType)} options={Object.values(ClusterMetricsResourceType)}
onChange={this.onChangeSelect} onChange={this.onChangeSelect}
formatOptionLabel={this.formatOptionLabel} formatOptionLabel={this.formatOptionLabel}
themeName="lens"
/> />
<Button <Button
primary primary

View File

@ -138,26 +138,30 @@ export class ClusterPrometheusSetting extends React.Component<Props> {
this.onSaveProvider(); this.onSaveProvider();
}} }}
options={this.options} options={this.options}
themeName="lens"
/> />
<small className="hint">What query format is used to fetch metrics from Prometheus</small> <small className="hint">What query format is used to fetch metrics from Prometheus</small>
</> </>
} }
</section> </section>
{this.canEditPrometheusPath && ( {this.canEditPrometheusPath && (
<section> <>
<p>Prometheus service address.</p> <hr/>
<Input <section>
theme="round-black" <SubTitle title="Prometheus service address" />
value={this.path} <Input
onChange={(value) => this.path = value} theme="round-black"
onBlur={this.onSavePath} value={this.path}
placeholder="<namespace>/<service>:<port>" onChange={(value) => this.path = value}
/> onBlur={this.onSavePath}
<small className="hint"> placeholder="<namespace>/<service>:<port>"
An address to an existing Prometheus installation{" "} />
({"<namespace>/<service>:<port>"}). {productName} tries to auto-detect address if left empty. <small className="hint">
</small> An address to an existing Prometheus installation{" "}
</section> ({"<namespace>/<service>:<port>"}). {productName} tries to auto-detect address if left empty.
</small>
</section>
</>
)} )}
</> </>
); );

View File

@ -23,7 +23,10 @@
.el-contents { .el-contents {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
margin: $padding 0px;
&:not(:empty) {
margin: $padding 0px;
}
.el-value-remove { .el-value-remove {
.Icon { .Icon {

View File

@ -25,7 +25,7 @@ import { observer } from "mobx-react";
import React from "react"; import React from "react";
import { Icon } from "../icon"; import { Icon } from "../icon";
import { Input } from "../input"; import { Input, InputProps } from "../input";
import { boundMethod } from "../../utils"; import { boundMethod } from "../../utils";
export interface Props<T> { export interface Props<T> {
@ -37,11 +37,13 @@ export interface Props<T> {
// An optional prop used to convert T to a displayable string // An optional prop used to convert T to a displayable string
// defaults to `String` // defaults to `String`
renderItem?: (item: T, index: number) => React.ReactNode, renderItem?: (item: T, index: number) => React.ReactNode,
inputTheme?: InputProps["theme"];
} }
const defaultProps: Partial<Props<any>> = { const defaultProps: Partial<Props<any>> = {
placeholder: "Add new item...", placeholder: "Add new item...",
renderItem: (item: any, index: number) => <React.Fragment key={index}>{item}</React.Fragment> renderItem: (item: any, index: number) => <React.Fragment key={index}>{item}</React.Fragment>,
inputTheme: "round"
}; };
@observer @observer
@ -59,13 +61,13 @@ export class EditableList<T> extends React.Component<Props<T>> {
} }
render() { render() {
const { items, remove, renderItem, placeholder } = this.props; const { items, remove, renderItem, placeholder, inputTheme } = this.props;
return ( return (
<div className="EditableList"> <div className="EditableList">
<div className="el-header"> <div className="el-header">
<Input <Input
theme="round" theme={inputTheme}
onSubmit={this.onSubmit} onSubmit={this.onSubmit}
placeholder={placeholder} placeholder={placeholder}
/> />

View File

@ -20,17 +20,19 @@
*/ */
.SettingLayout { .SettingLayout {
--width: 75%;
--nav-width: 180px;
--nav-column-width: 30vw; --nav-column-width: 30vw;
width: 100%; width: 100%;
height: 100%; height: 100%;
display: grid !important; display: grid;
color: var(--settingsColor); color: var(--settingsColor);
position: fixed;
@include media("<1000px") { z-index: 13!important;
--width: 85%; left: 0;
} top: 0;
right: 0;
bottom: 0;
height: unset;
background-color: var(--settingsBackground);
&.showNavigation { &.showNavigation {
grid-template-columns: var(--nav-column-width) 1fr; grid-template-columns: var(--nav-column-width) 1fr;
@ -40,18 +42,6 @@
} }
} }
// covers whole app view area
&.showOnTop {
position: fixed !important; // allow to cover ClustersMenu
z-index: 13;
left: 0;
top: 0;
right: 0;
bottom: 0;
height: unset;
background-color: var(--settingsBackground);
}
> .sidebarRegion { > .sidebarRegion {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
@ -124,7 +114,9 @@
justify-content: center; justify-content: center;
> .content { > .content {
width: var(--width); width: 100%;
max-width: 740px;
min-width: 460px;
padding: 60px 40px 80px; padding: 60px 40px 80px;
> section { > section {
@ -210,6 +202,7 @@
.hint { .hint {
margin-top: 8px; margin-top: 8px;
font-size: 14px; font-size: 14px;
line-height: 20px;
} }
.SubTitle { .SubTitle {

View File

@ -81,7 +81,7 @@ export class SettingLayout extends React.Component<SettingLayoutProps> {
contentClass, provideBackButtonNavigation, contentClass, provideBackButtonNavigation,
contentGaps, navigation, children, ...elemProps contentGaps, navigation, children, ...elemProps
} = this.props; } = this.props;
const className = cssNames("SettingLayout", "showOnTop", { showNavigation: navigation }, this.props.className); const className = cssNames("SettingLayout", { showNavigation: navigation }, this.props.className);
return ( return (
<div {...elemProps} className={className}> <div {...elemProps} className={className}>