1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/renderer/components/+network-ingresses/ingress.store.ts
Roman 35732e5a59 autobind-related fixes / refactoring
Signed-off-by: Roman <ixrock@gmail.com>
2021-05-04 20:41:20 +03:00

29 lines
750 B
TypeScript

import { makeObservable, observable } from "mobx";
import { KubeObjectStore } from "../../kube-object.store";
import { IIngressMetrics, Ingress, ingressApi } from "../../api/endpoints";
import { apiManager } from "../../api/api-manager";
import { autobind } from "../../../common/utils";
@autobind
export class IngressStore extends KubeObjectStore<Ingress> {
api = ingressApi;
@observable metrics: IIngressMetrics = null;
constructor() {
super();
makeObservable(this);
}
async loadMetrics(ingress: Ingress) {
this.metrics = await this.api.getMetrics(ingress.getName(), ingress.getNs());
}
reset() {
this.metrics = null;
}
}
export const ingressStore = new IngressStore();
apiManager.registerStore(ingressStore);