mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
fix: terminal was broken at some point during refactoring
Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
parent
2658a0ac74
commit
1510091cd2
@ -109,7 +109,7 @@ export class Cluster implements ClusterModel {
|
|||||||
this.disposers.push(
|
this.disposers.push(
|
||||||
() => clearInterval(refreshStatusTimer),
|
() => clearInterval(refreshStatusTimer),
|
||||||
() => clearInterval(refreshEventsTimer),
|
() => clearInterval(refreshEventsTimer),
|
||||||
reaction(() => this.getState(), this.pushState, {
|
reaction(this.getState, this.pushState, {
|
||||||
fireImmediately: true
|
fireImmediately: true
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@ -319,8 +319,8 @@ export class Cluster implements ClusterModel {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// serializable cluster-info for push-notifications
|
// serializable cluster-state (mostly used for push-notifications)
|
||||||
getState(): ClusterState {
|
getState = (): ClusterState => {
|
||||||
const state: ClusterState = {
|
const state: ClusterState = {
|
||||||
...this.toJSON(),
|
...this.toJSON(),
|
||||||
initialized: this.initialized,
|
initialized: this.initialized,
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import http from "http";
|
|||||||
import httpProxy from "http-proxy";
|
import httpProxy from "http-proxy";
|
||||||
import url from "url";
|
import url from "url";
|
||||||
import * as WebSocket from "ws"
|
import * as WebSocket from "ws"
|
||||||
import * as nodeShell from "./node-shell-session"
|
import { openShell } from "./node-shell-session";
|
||||||
import { Router } from "./router"
|
import { Router } from "./router"
|
||||||
import { ClusterManager } from "./cluster-manager"
|
import { ClusterManager } from "./cluster-manager"
|
||||||
import { ContextHandler } from "./context-handler";
|
import { ContextHandler } from "./context-handler";
|
||||||
@ -96,10 +96,10 @@ export class LensProxy {
|
|||||||
|
|
||||||
protected createWsListener(): WebSocket.Server {
|
protected createWsListener(): WebSocket.Server {
|
||||||
const ws = new WebSocket.Server({ noServer: true })
|
const ws = new WebSocket.Server({ noServer: true })
|
||||||
return ws.on("connection", (async (socket: WebSocket, req: http.IncomingMessage) => {
|
return ws.on("connection", ((socket: WebSocket, req: http.IncomingMessage) => {
|
||||||
const cluster = this.clusterManager.getClusterForRequest(req);
|
const cluster = this.clusterManager.getClusterForRequest(req);
|
||||||
const nodeParam = url.parse(req.url, true).query["node"]?.toString();
|
const nodeParam = url.parse(req.url, true).query["node"]?.toString();
|
||||||
await nodeShell.open(socket, cluster, nodeParam);
|
openShell(socket, cluster, nodeParam);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -133,9 +133,13 @@ export class NodeShellSession extends ShellSession {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function open(socket: WebSocket, cluster: Cluster, nodeName?: string): Promise<ShellSession> {
|
export async function openShell(socket: WebSocket, cluster: Cluster, nodeName?: string): Promise<ShellSession> {
|
||||||
|
let shell: ShellSession;
|
||||||
if (nodeName) {
|
if (nodeName) {
|
||||||
return new NodeShellSession(socket, cluster, nodeName)
|
shell = new NodeShellSession(socket, cluster, nodeName)
|
||||||
|
} else {
|
||||||
|
shell = new ShellSession(socket, cluster);
|
||||||
}
|
}
|
||||||
return new ShellSession(socket, cluster);
|
shell.open()
|
||||||
|
return shell;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,8 +11,6 @@ import { helmCli } from "./helm/helm-cli"
|
|||||||
import { isWindows } from "../common/vars";
|
import { isWindows } from "../common/vars";
|
||||||
import { tracker } from "../common/tracker";
|
import { tracker } from "../common/tracker";
|
||||||
|
|
||||||
// fixme: terminal doesn't work in ui
|
|
||||||
|
|
||||||
export class ShellSession extends EventEmitter {
|
export class ShellSession extends EventEmitter {
|
||||||
static shellEnvs: Map<string, any> = new Map()
|
static shellEnvs: Map<string, any> = new Map()
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,8 @@ import { observable, when } from "mobx";
|
|||||||
import { autobind, interval } from "./utils";
|
import { autobind, interval } from "./utils";
|
||||||
import { apiBase } from "./api";
|
import { apiBase } from "./api";
|
||||||
|
|
||||||
|
// todo: use user-store.ts as isomorphic-store with config/settings for ui
|
||||||
|
|
||||||
@autobind()
|
@autobind()
|
||||||
export class ConfigStore {
|
export class ConfigStore {
|
||||||
protected updater = interval(60, this.load);
|
protected updater = interval(60, this.load);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user