mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Remove api lookup in KubeObjectStore (#4092)
This commit is contained in:
parent
93ea1a1e24
commit
1f42a5148e
@ -26,7 +26,6 @@ import { autoBind, noop, rejectPromiseBy } from "../utils";
|
|||||||
import { KubeObject, KubeStatus } from "./kube-object";
|
import { KubeObject, KubeStatus } from "./kube-object";
|
||||||
import type { IKubeWatchEvent } from "./kube-watch-api";
|
import type { IKubeWatchEvent } from "./kube-watch-api";
|
||||||
import { ItemStore } from "../item.store";
|
import { ItemStore } from "../item.store";
|
||||||
import { apiManager } from "./api-manager";
|
|
||||||
import { ensureObjectSelfLink, IKubeApiQueryParams, KubeApi } from "./kube-api";
|
import { ensureObjectSelfLink, IKubeApiQueryParams, KubeApi } from "./kube-api";
|
||||||
import { parseKubeApi } from "./kube-api-parse";
|
import { parseKubeApi } from "./kube-api-parse";
|
||||||
import type { KubeJsonApiData } from "./kube-json-api";
|
import type { KubeJsonApiData } from "./kube-json-api";
|
||||||
@ -401,12 +400,11 @@ export abstract class KubeObjectStore<T extends KubeObject> extends ItemStore<T>
|
|||||||
for (const { type, object } of this.eventsBuffer.clear()) {
|
for (const { type, object } of this.eventsBuffer.clear()) {
|
||||||
const index = items.findIndex(item => item.getId() === object.metadata?.uid);
|
const index = items.findIndex(item => item.getId() === object.metadata?.uid);
|
||||||
const item = items[index];
|
const item = items[index];
|
||||||
const api = apiManager.getApiByKind(object.kind, object.apiVersion);
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "ADDED":
|
case "ADDED":
|
||||||
case "MODIFIED":
|
case "MODIFIED":
|
||||||
const newItem = new api.objectConstructor(object) as T;
|
const newItem = new this.api.objectConstructor(object);
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
items.push(newItem);
|
items.push(newItem);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user