Removed package "autobind-decorator" and @boundMethod in favour of "auto-bind" util for constructors-only. (#5218)

This commit is contained in:
Roman authored and GitHub committed 2022-04-07 17:21:54 +03:00
1 parent 5f145e69e5
commit 06e7dfce5e
45 files changed
+150 -180

No files matched your search

@@ -11,7 +11,7 @@ import { reaction } from "mobx";
import { disposeOnUnmount, observer } from "mobx-react";
import { podsStore } from "./pods.store";
import type { Pod } from "../../../common/k8s-api/endpoints";
import { boundMethod, bytesToUnits, cssNames, interval, prevDefault } from "../../utils";
import { autoBind, bytesToUnits, cssNames, interval, prevDefault } from "../../utils";
import { LineProgress } from "../line-progress";
import type { KubeObject } from "../../../common/k8s-api/kube-object";
import { Table, TableCell, TableHead, TableRow } from "../table";
@@ -36,6 +36,11 @@ export interface PodDetailsListProps {
@observer
export class PodDetailsList extends React.Component<PodDetailsListProps> {
constructor(props: PodDetailsListProps) {
super(props);
autoBind(this);
}
private metricsWatcher = interval(120, () => {
podsStore.loadKubeMetrics(this.props.owner.getNs());
});
@@ -88,7 +93,6 @@ export class PodDetailsList extends React.Component<PodDetailsListProps> {
);
}
@boundMethod
getTableRow(uid: string) {
const { pods } = this.props;
const pod = pods.find(pod => pod.getId() == uid);
@@ -13,7 +13,7 @@ import { observable, reaction, makeObservable } from "mobx";
import { type IPodMetrics, nodesApi, Pod, getMetricsForPods } from "../../../common/k8s-api/endpoints";
import { DrawerItem, DrawerTitle } from "../drawer";
import { Badge } from "../badge";
import { boundMethod, cssNames, toJS } from "../../utils";
import { cssNames, toJS } from "../../utils";
import { PodDetailsContainer } from "./pod-details-container";
import { PodDetailsAffinities } from "./pod-details-affinities";
import { PodDetailsTolerations } from "./pod-details-tolerations";
@@ -51,13 +51,12 @@ export class PodDetails extends React.Component<PodDetailsProps> {
]);
}
@boundMethod
async loadMetrics() {
loadMetrics = async () => {
const { object: pod } = this.props;
this.metrics = await getMetricsForPods([pod], pod.getNs());
this.containerMetrics = await getMetricsForPods([pod], pod.getNs(), "container, namespace");
}
};
render() {
const { object: pod } = this.props;