Add the ability to hide metrics from the UI (#2036)

This commit is contained in:
Violetta authored and GitHub committed 2021-03-16 09:22:08 -04:00
1 parent 7d14ba5e48
commit a9a5766920
19 files changed
+303 -38

No files matched your search

@@ -4,7 +4,7 @@ import React from "react";
import { disposeOnUnmount, observer } from "mobx-react";
import { reaction } from "mobx";
import { DrawerItem, DrawerTitle } from "../drawer";
import { Ingress, ILoadBalancerIngress } from "../../api/endpoints";
import { ILoadBalancerIngress, Ingress } from "../../api/endpoints";
import { Table, TableCell, TableHead, TableRow } from "../table";
import { KubeEventDetails } from "../+events/kube-event-details";
import { ingressStore } from "./ingress.store";
@@ -14,6 +14,8 @@ import { IngressCharts } from "./ingress-charts";
import { KubeObjectMeta } from "../kube-object/kube-object-meta";
import { kubeObjectDetailRegistry } from "../../api/kube-object-detail-registry";
import { getBackendServiceNamePort } from "../../api/endpoints/ingress.api";
import { ResourceType } from "../+cluster-settings/components/cluster-metrics-setting";
import { clusterStore } from "../../../common/cluster-store";
interface Props extends KubeObjectDetailsProps<Ingress> {
}
@@ -106,17 +108,20 @@ export class IngressDetails extends React.Component<Props> {
"Network",
"Duration",
];
const isMetricHidden = clusterStore.isMetricHidden(ResourceType.Ingress);
const { serviceName, servicePort } = ingress.getServiceNamePort();
return (
<div className="IngressDetails">
<ResourceMetrics
loader={() => ingressStore.loadMetrics(ingress)}
tabs={metricTabs} object={ingress} params={{ metrics }}
>
<IngressCharts/>
</ResourceMetrics>
{!isMetricHidden && (
<ResourceMetrics
loader={() => ingressStore.loadMetrics(ingress)}
tabs={metricTabs} object={ingress} params={{ metrics }}
>
<IngressCharts/>
</ResourceMetrics>
)}
<KubeObjectMeta object={ingress}/>
<DrawerItem name="Ports">
{ingress.getPorts()}