1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/extensions/registries/kube-object-status-registry.ts
Roman a489d9aabe more fixes & refactoring
Signed-off-by: Roman <ixrock@gmail.com>
2020-11-12 13:58:05 +02:00

19 lines
659 B
TypeScript

import { KubeObject, KubeObjectStatus } from "../renderer-api/k8s-api";
import { BaseRegistry, BaseRegistryItem } from "./base-registry";
export interface KubeObjectStatusRegistration extends BaseRegistryItem {
kind: string;
apiVersions: string[];
resolve: (object: KubeObject) => KubeObjectStatus;
}
export class KubeObjectStatusRegistry extends BaseRegistry<KubeObjectStatusRegistration> {
getItemsForKind(kind: string, apiVersion: string) {
return this.getItems().filter((item) => {
return item.kind === kind && item.apiVersions.includes(apiVersion)
})
}
}
export const kubeObjectStatusRegistry = new KubeObjectStatusRegistry();