Export KubeJsonApi to extensions (#4496)

* Export KubeJsonApi to extensions

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Make forCluster() to consume clusterId as arg

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Fix lint

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev authored and GitHub committed 2021-12-09 15:11:34 +03:00
1 parent 25f4a1f3ba
commit 3dd6b432c9
3 files changed
+4 -4

No files matched your search

+2 -3
View File
@@ -21,7 +21,6 @@
import { JsonApi, JsonApiData, JsonApiError } from "./json-api";
import type { Response } from "node-fetch";
import type { Cluster } from "../../main/cluster";
import { LensProxy } from "../../main/lens-proxy";
import { apiKubePrefix, isDebugging } from "../vars";
@@ -73,7 +72,7 @@ export interface KubeJsonApiError extends JsonApiError {
}
export class KubeJsonApi extends JsonApi<KubeJsonApiData> {
static forCluster(cluster: Cluster): KubeJsonApi {
static forCluster(clusterId: string): KubeJsonApi {
const port = LensProxy.getInstance().port;
return new this({
@@ -82,7 +81,7 @@ export class KubeJsonApi extends JsonApi<KubeJsonApiData> {
debug: isDebugging,
}, {
headers: {
"Host": `${cluster.id}.localhost:${port}`,
"Host": `${clusterId}.localhost:${port}`,
},
});
}