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 React from "react";
|
||||||
import { disposeOnUnmount, observer } from "mobx-react";
|
import { disposeOnUnmount, observer } from "mobx-react";
|
||||||
import { observable, reaction } from "mobx";
|
import { makeObservable, observable, reaction } from "mobx";
|
||||||
import { DrawerItem, DrawerTitle } from "../drawer";
|
import { DrawerItem, DrawerTitle } from "../drawer";
|
||||||
import type { ILoadBalancerIngress, Ingress } from "../../../common/k8s-api/endpoints";
|
import type { ILoadBalancerIngress, Ingress } from "../../../common/k8s-api/endpoints";
|
||||||
import { Table, TableCell, TableHead, TableRow } from "../table";
|
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 { getBackendServiceNamePort, getMetricsForIngress, IIngressMetrics } from "../../../common/k8s-api/endpoints/ingress.api";
|
||||||
import { getActiveClusterEntity } from "../../api/catalog-entity-registry";
|
import { getActiveClusterEntity } from "../../api/catalog-entity-registry";
|
||||||
import { ClusterMetricsResourceType } from "../../../common/cluster-types";
|
import { ClusterMetricsResourceType } from "../../../common/cluster-types";
|
||||||
|
import { boundMethod } from "../../utils";
|
||||||
|
|
||||||
interface Props extends KubeObjectDetailsProps<Ingress> {
|
interface Props extends KubeObjectDetailsProps<Ingress> {
|
||||||
}
|
}
|
||||||
@ -42,11 +43,17 @@ interface Props extends KubeObjectDetailsProps<Ingress> {
|
|||||||
export class IngressDetails extends React.Component<Props> {
|
export class IngressDetails extends React.Component<Props> {
|
||||||
@observable metrics: IIngressMetrics = null;
|
@observable metrics: IIngressMetrics = null;
|
||||||
|
|
||||||
|
constructor(props: Props) {
|
||||||
|
super(props);
|
||||||
|
makeObservable(this);
|
||||||
|
}
|
||||||
|
|
||||||
@disposeOnUnmount
|
@disposeOnUnmount
|
||||||
clean = reaction(() => this.props.object, () => {
|
clean = reaction(() => this.props.object, () => {
|
||||||
this.metrics = null;
|
this.metrics = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@boundMethod
|
||||||
async loadMetrics() {
|
async loadMetrics() {
|
||||||
const { object: ingress } = this.props;
|
const { object: ingress } = this.props;
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
import "./volume-claim-details.scss";
|
import "./volume-claim-details.scss";
|
||||||
|
|
||||||
import React, { Fragment } from "react";
|
import React, { Fragment } from "react";
|
||||||
import { action, observable, reaction } from "mobx";
|
import { makeObservable, observable, reaction } from "mobx";
|
||||||
import { disposeOnUnmount, observer } from "mobx-react";
|
import { disposeOnUnmount, observer } from "mobx-react";
|
||||||
import { DrawerItem, DrawerTitle } from "../drawer";
|
import { DrawerItem, DrawerTitle } from "../drawer";
|
||||||
import { Badge } from "../badge";
|
import { Badge } from "../badge";
|
||||||
@ -36,6 +36,7 @@ import { getActiveClusterEntity } from "../../api/catalog-entity-registry";
|
|||||||
import { ClusterMetricsResourceType } from "../../../common/cluster-types";
|
import { ClusterMetricsResourceType } from "../../../common/cluster-types";
|
||||||
import { KubeObjectMeta } from "../kube-object-meta";
|
import { KubeObjectMeta } from "../kube-object-meta";
|
||||||
import { getDetailsUrl } from "../kube-detail-params";
|
import { getDetailsUrl } from "../kube-detail-params";
|
||||||
|
import { boundMethod } from "../../utils";
|
||||||
|
|
||||||
interface Props extends KubeObjectDetailsProps<PersistentVolumeClaim> {
|
interface Props extends KubeObjectDetailsProps<PersistentVolumeClaim> {
|
||||||
}
|
}
|
||||||
@ -44,12 +45,17 @@ interface Props extends KubeObjectDetailsProps<PersistentVolumeClaim> {
|
|||||||
export class PersistentVolumeClaimDetails extends React.Component<Props> {
|
export class PersistentVolumeClaimDetails extends React.Component<Props> {
|
||||||
@observable metrics: IPvcMetrics = null;
|
@observable metrics: IPvcMetrics = null;
|
||||||
|
|
||||||
|
constructor(props: Props) {
|
||||||
|
super(props);
|
||||||
|
makeObservable(this);
|
||||||
|
}
|
||||||
|
|
||||||
@disposeOnUnmount
|
@disposeOnUnmount
|
||||||
clean = reaction(() => this.props.object, () => {
|
clean = reaction(() => this.props.object, () => {
|
||||||
this.metrics = null;
|
this.metrics = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@action
|
@boundMethod
|
||||||
async loadMetrics() {
|
async loadMetrics() {
|
||||||
const { object: volumeClaim } = this.props;
|
const { object: volumeClaim } = this.props;
|
||||||
|
|
||||||
|
|||||||
@ -83,7 +83,7 @@ export class StatefulSetDetails extends React.Component<Props> {
|
|||||||
<div className="StatefulSetDetails">
|
<div className="StatefulSetDetails">
|
||||||
{!isMetricHidden && podsStore.isLoaded && (
|
{!isMetricHidden && podsStore.isLoaded && (
|
||||||
<ResourceMetrics
|
<ResourceMetrics
|
||||||
loader={() => this.loadMetrics}
|
loader={this.loadMetrics}
|
||||||
tabs={podMetricTabs} object={statefulSet} params={{ metrics: this.metrics }}
|
tabs={podMetricTabs} object={statefulSet} params={{ metrics: this.metrics }}
|
||||||
>
|
>
|
||||||
<PodCharts/>
|
<PodCharts/>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user