mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix metrics loading on Ingress, PVC and StatefulSet details (#3632)
Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
parent
4002844617
commit
21a41b7ea9
@ -23,7 +23,7 @@ import "./ingress-details.scss";
|
||||
|
||||
import React from "react";
|
||||
import { disposeOnUnmount, observer } from "mobx-react";
|
||||
import { observable, reaction } from "mobx";
|
||||
import { makeObservable, observable, reaction } from "mobx";
|
||||
import { DrawerItem, DrawerTitle } from "../drawer";
|
||||
import type { ILoadBalancerIngress, Ingress } from "../../../common/k8s-api/endpoints";
|
||||
import { Table, TableCell, TableHead, TableRow } from "../table";
|
||||
@ -34,6 +34,7 @@ import { KubeObjectMeta } from "../kube-object-meta";
|
||||
import { getBackendServiceNamePort, getMetricsForIngress, IIngressMetrics } from "../../../common/k8s-api/endpoints/ingress.api";
|
||||
import { getActiveClusterEntity } from "../../api/catalog-entity-registry";
|
||||
import { ClusterMetricsResourceType } from "../../../common/cluster-types";
|
||||
import { boundMethod } from "../../utils";
|
||||
|
||||
interface Props extends KubeObjectDetailsProps<Ingress> {
|
||||
}
|
||||
@ -42,11 +43,17 @@ interface Props extends KubeObjectDetailsProps<Ingress> {
|
||||
export class IngressDetails extends React.Component<Props> {
|
||||
@observable metrics: IIngressMetrics = null;
|
||||
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
makeObservable(this);
|
||||
}
|
||||
|
||||
@disposeOnUnmount
|
||||
clean = reaction(() => this.props.object, () => {
|
||||
this.metrics = null;
|
||||
});
|
||||
|
||||
@boundMethod
|
||||
async loadMetrics() {
|
||||
const { object: ingress } = this.props;
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
import "./volume-claim-details.scss";
|
||||
|
||||
import React, { Fragment } from "react";
|
||||
import { action, observable, reaction } from "mobx";
|
||||
import { makeObservable, observable, reaction } from "mobx";
|
||||
import { disposeOnUnmount, observer } from "mobx-react";
|
||||
import { DrawerItem, DrawerTitle } from "../drawer";
|
||||
import { Badge } from "../badge";
|
||||
@ -36,6 +36,7 @@ import { getActiveClusterEntity } from "../../api/catalog-entity-registry";
|
||||
import { ClusterMetricsResourceType } from "../../../common/cluster-types";
|
||||
import { KubeObjectMeta } from "../kube-object-meta";
|
||||
import { getDetailsUrl } from "../kube-detail-params";
|
||||
import { boundMethod } from "../../utils";
|
||||
|
||||
interface Props extends KubeObjectDetailsProps<PersistentVolumeClaim> {
|
||||
}
|
||||
@ -44,12 +45,17 @@ interface Props extends KubeObjectDetailsProps<PersistentVolumeClaim> {
|
||||
export class PersistentVolumeClaimDetails extends React.Component<Props> {
|
||||
@observable metrics: IPvcMetrics = null;
|
||||
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
makeObservable(this);
|
||||
}
|
||||
|
||||
@disposeOnUnmount
|
||||
clean = reaction(() => this.props.object, () => {
|
||||
this.metrics = null;
|
||||
});
|
||||
|
||||
@action
|
||||
@boundMethod
|
||||
async loadMetrics() {
|
||||
const { object: volumeClaim } = this.props;
|
||||
|
||||
|
||||
@ -83,7 +83,7 @@ export class StatefulSetDetails extends React.Component<Props> {
|
||||
<div className="StatefulSetDetails">
|
||||
{!isMetricHidden && podsStore.isLoaded && (
|
||||
<ResourceMetrics
|
||||
loader={() => this.loadMetrics}
|
||||
loader={this.loadMetrics}
|
||||
tabs={podMetricTabs} object={statefulSet} params={{ metrics: this.metrics }}
|
||||
>
|
||||
<PodCharts/>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user