mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Start authentication proxy when opening cluster settings (#1063)
Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
parent
dc07d646ec
commit
daa4992f2b
@ -5,11 +5,10 @@ import { tracker } from "./tracker";
|
||||
export const clusterIpc = {
|
||||
activate: createIpcChannel({
|
||||
channel: "cluster:activate",
|
||||
handle: (clusterId: ClusterId, frameId?: number) => {
|
||||
handle: (clusterId: ClusterId, force = false) => {
|
||||
const cluster = clusterStore.getById(clusterId);
|
||||
if (cluster) {
|
||||
if (frameId) cluster.frameId = frameId; // save cluster's webFrame.routingId to be able to send push-updates
|
||||
return cluster.activate();
|
||||
return cluster.activate(force);
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
@ -46,6 +46,7 @@ export class Cluster implements ClusterModel {
|
||||
public contextHandler: ContextHandler;
|
||||
protected kubeconfigManager: KubeconfigManager;
|
||||
protected eventDisposers: Function[] = [];
|
||||
protected activated = false;
|
||||
|
||||
whenInitialized = when(() => this.initialized);
|
||||
whenReady = when(() => this.ready);
|
||||
@ -126,7 +127,10 @@ export class Cluster implements ClusterModel {
|
||||
}
|
||||
|
||||
@action
|
||||
async activate() {
|
||||
async activate(force = false ) {
|
||||
if (this.activated && !force) {
|
||||
return this.pushState();
|
||||
}
|
||||
logger.info(`[CLUSTER]: activate`, this.getMeta());
|
||||
await this.whenInitialized;
|
||||
if (!this.eventDisposers.length) {
|
||||
@ -142,6 +146,7 @@ export class Cluster implements ClusterModel {
|
||||
this.kubeCtl = new Kubectl(this.version)
|
||||
this.kubeCtl.ensureKubectl() // download kubectl in background, so it's not blocking dashboard
|
||||
}
|
||||
this.activated = true
|
||||
return this.pushState();
|
||||
}
|
||||
|
||||
@ -162,6 +167,7 @@ export class Cluster implements ClusterModel {
|
||||
this.online = false;
|
||||
this.accessible = false;
|
||||
this.ready = false;
|
||||
this.activated = false;
|
||||
this.pushState();
|
||||
}
|
||||
|
||||
@ -184,9 +190,7 @@ export class Cluster implements ClusterModel {
|
||||
this.refreshEvents(),
|
||||
this.refreshAllowedResources(),
|
||||
]);
|
||||
if (!this.ready) {
|
||||
this.ready = true
|
||||
}
|
||||
this.ready = true
|
||||
}
|
||||
this.pushState();
|
||||
}
|
||||
|
||||
@ -46,8 +46,9 @@ export class ClusterSettings extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
refreshCluster = () => {
|
||||
refreshCluster = async () => {
|
||||
if(this.cluster) {
|
||||
await clusterIpc.activate.invokeFromRenderer(this.cluster.id);
|
||||
clusterIpc.refresh.invokeFromRenderer(this.cluster.id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,13 +47,14 @@ export class ClusterStatus extends React.Component<Props> {
|
||||
ipcRenderer.removeAllListeners(`kube-auth:${this.props.clusterId}`);
|
||||
}
|
||||
|
||||
activateCluster = async () => {
|
||||
await clusterIpc.activate.invokeFromRenderer(this.props.clusterId);
|
||||
activateCluster = async (force = false) => {
|
||||
await clusterIpc.activate.invokeFromRenderer(this.props.clusterId, force);
|
||||
}
|
||||
|
||||
reconnect = async () => {
|
||||
this.authOutput = []
|
||||
this.isReconnecting = true;
|
||||
await this.activateCluster();
|
||||
await this.activateCluster(true);
|
||||
this.isReconnecting = false;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user