mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add eslint rule padding-line-between-statements (#1593)
Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
1 parent
7b77f18376
commit
dcf253e7d5
401 files changed
+2018
-40
No files matched your search
@@ -52,15 +52,19 @@ class PortForward {
|
||||
PortForward.portForwards.push(this);
|
||||
this.process.on("exit", () => {
|
||||
const index = PortForward.portForwards.indexOf(this);
|
||||
|
||||
if (index > -1) {
|
||||
PortForward.portForwards.splice(index, 1);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
await tcpPortUsed.waitUntilUsed(this.localPort, 500, 15000);
|
||||
|
||||
return true;
|
||||
} catch (error) {
|
||||
this.process.kill();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -75,11 +79,11 @@ class PortForwardRoute extends LensApi {
|
||||
public async routePortForward(request: LensApiRequest) {
|
||||
const { params, response, cluster} = request;
|
||||
const { namespace, port, resourceType, resourceName } = params;
|
||||
|
||||
let portForward = PortForward.getPortforward({
|
||||
clusterId: cluster.id, kind: resourceType, name: resourceName,
|
||||
namespace, port
|
||||
});
|
||||
|
||||
if (!portForward) {
|
||||
logger.info(`Creating a new port-forward ${namespace}/${resourceType}/${resourceName}:${port}`);
|
||||
portForward = new PortForward({
|
||||
@@ -91,10 +95,12 @@ class PortForwardRoute extends LensApi {
|
||||
kubeConfig: cluster.getProxyKubeconfigPath()
|
||||
});
|
||||
const started = await portForward.start();
|
||||
|
||||
if (!started) {
|
||||
this.respondJson(response, {
|
||||
message: "Failed to open port-forward"
|
||||
}, 400);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user