mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix crash will looking up api refs
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
bde34646cf
commit
4f51a5431c
@ -394,16 +394,12 @@ export class KubeApi<
|
|||||||
}
|
}
|
||||||
|
|
||||||
getUrl({ name, namespace }: Partial<ResourceDescriptor> = {}, query?: Partial<KubeApiQueryParams>) {
|
getUrl({ name, namespace }: Partial<ResourceDescriptor> = {}, query?: Partial<KubeApiQueryParams>) {
|
||||||
if (!this.isNamespaced && namespace) {
|
|
||||||
throw new Error("Tried to delete cluster scoped resource in a namespace");
|
|
||||||
}
|
|
||||||
|
|
||||||
const resourcePath = createKubeApiURL({
|
const resourcePath = createKubeApiURL({
|
||||||
apiPrefix: this.apiPrefix,
|
apiPrefix: this.apiPrefix,
|
||||||
apiVersion: this.apiVersionWithGroup,
|
apiVersion: this.apiVersionWithGroup,
|
||||||
resource: this.apiResource,
|
resource: this.apiResource,
|
||||||
namespace: this.isNamespaced
|
namespace: this.isNamespaced
|
||||||
? namespace || "default"
|
? namespace ?? "default" // allow `""` to mean all namespaces
|
||||||
: undefined,
|
: undefined,
|
||||||
name,
|
name,
|
||||||
});
|
});
|
||||||
@ -612,6 +608,8 @@ export class KubeApi<
|
|||||||
watchId = `${this.kind.toLowerCase()}-${this.watchId++}`,
|
watchId = `${this.kind.toLowerCase()}-${this.watchId++}`,
|
||||||
} = opts ?? {};
|
} = opts ?? {};
|
||||||
|
|
||||||
|
console.log(`watching ${this.apiBase} in namespace="${namespace}"`);
|
||||||
|
|
||||||
// Create AbortController for this request
|
// Create AbortController for this request
|
||||||
const abortController = new WrappedAbortController(opts?.abortController);
|
const abortController = new WrappedAbortController(opts?.abortController);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user