improved singleton types inferring

Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
Roman committed 2020-07-17 20:00:47 +03:00
1 parent 0dbb47a398
commit a3edb75fea
9 files changed
+17 -16

No files matched your search

+1 -1
View File
@@ -66,7 +66,7 @@ async function main() {
// run proxy
try {
proxyServer = LensProxy.create(clusterManager);
proxyServer = LensProxy.create(proxyPort, clusterManager);
} catch (error) {
logger.error(`Could not start proxy (127.0.0:${proxyPort}): ${error.message}`)
await dialog.showErrorBox("Lens Error", `Could not start proxy (127.0.0:${proxyPort}): ${error.message || "unknown error"}`)
+4 -6
View File
@@ -11,22 +11,20 @@ import { apiKubePrefix } from "../common/vars";
import logger from "./logger"
export class LensProxy {
protected clusterManager: ClusterManager
protected proxyServer: http.Server
protected router: Router
protected closed = false
protected retryCounters = new Map<string, number>()
static create(clusterManager: ClusterManager) {
return new LensProxy(clusterManager).listen();
static create(port: number, clusterManager: ClusterManager) {
return new LensProxy(port, clusterManager).listen();
}
private constructor(clusterManager: ClusterManager) {
this.clusterManager = clusterManager;
private constructor(protected port: number, protected clusterManager: ClusterManager) {
this.router = new Router();
}
listen(port = this.clusterManager.port): this {
listen(port = this.port): this {
this.proxyServer = this.buildCustomProxy().listen(port);
logger.info(`LensProxy server has started http://localhost:${port}`);
return this;
+1
View File
@@ -5,6 +5,7 @@ import type { ClusterId } from "../common/cluster-store";
import { clusterStore } from "../common/cluster-store";
import logger from "./logger";
// fixme: error when removing active cluster (can't activate next view => empty window)
// fixme: remove switching view delay on first load
export class WindowManager {