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

Fine-tuning hidden metrics area

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2021-06-22 14:36:14 +03:00
parent 9a3c3ad1ce
commit 8af14ee8c5
3 changed files with 16 additions and 9 deletions

View File

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

View File

@ -119,7 +119,7 @@ export class ClusterMetricsSetting extends React.Component<Props> {
render() {
return (
<div className="MetricsSelect">
<div className="MetricsSelec0 mb-5">
<SubTitle title={"Hide metrics from the UI"}/>
<div className="flex gaps">
{this.renderMetricsSelect()}

View File

@ -25,6 +25,7 @@ import type { Cluster } from "../../../../main/cluster";
import { observable, reaction, makeObservable } from "mobx";
import { Badge } from "../../badge/badge";
import { Icon } from "../../icon/icon";
import { Notice } from "../../+extensions/notice";
interface Props {
cluster: Cluster;
@ -55,14 +56,20 @@ export class ShowMetricsSetting extends React.Component<Props> {
}
renderMetrics() {
const metrics = Array.from(this.hiddenMetrics);
if (!metrics.length) {
return (
<div className="flex-grow text-center">All metrics are visible on the UI</div>
);
}
return (
Array.from(this.hiddenMetrics).map(name => {
metrics.map(name => {
const tooltipId = `${name}`;
return (
<Badge key={name}>
<Badge key={name} flat>
<span id={tooltipId}>{name}</span>
<Icon
smallest
@ -79,9 +86,11 @@ export class ShowMetricsSetting extends React.Component<Props> {
render() {
return (
<div className="MetricsSelect flex wrap gaps">
{this.renderMetrics()}
</div>
<Notice>
<div className="MetricsSelect flex wrap gaps leading-relaxed">
{this.renderMetrics()}
</div>
</Notice>
);
}
}