1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Revert breaking change

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2021-12-03 08:59:02 -05:00
parent ab385d855a
commit 444e161f54
2 changed files with 10 additions and 11 deletions

View File

@ -289,9 +289,9 @@ export class KubeApi<T extends KubeObject> {
protected resourceVersions = new Map<string, string>();
protected watchDisposer: () => void;
private watchId = 1;
protected options: Pick<IKubeApiOptions<T>, "apiBase" | "checkPreferredVersion" | "fallbackApiBases">;
constructor({ objectConstructor, request, kind, isNamespaced, ...options }: IKubeApiOptions<T>) {
constructor(protected options: IKubeApiOptions<T>) {
const { objectConstructor, request, kind, isNamespaced } = options;
const { apiBase, apiPrefix, apiGroup, apiVersion, resource } = parseKubeApi(options.apiBase || objectConstructor.apiBase);
this.options = options;

View File

@ -29,15 +29,14 @@ import { CRDResourceStore } from "./crd-resource.store";
import { KubeObject } from "../../../common/k8s-api/kube-object";
function initStore(crd: CustomResourceDefinition) {
const apiBase = crd.getResourceApiBase();
const kind = crd.getResourceKind();
const isNamespaced = crd.isNamespaced();
const api = apiManager.getApi(apiBase) ?? new KubeApi({
objectConstructor: KubeObject,
apiBase,
kind,
isNamespaced,
});
const objectConstructor = class extends KubeObject {
readonly kind = crd.getResourceKind();
readonly namespaced = crd.isNamespaced();
readonly apiBase = crd.getResourceApiBase();
};
const api = apiManager.getApi(objectConstructor.apiBase)
?? new KubeApi({ objectConstructor });
if (!apiManager.getStore(api)) {
apiManager.registerStore(new CRDResourceStore(api));