mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Wait until cluster is ready before initializing cluster dashboard (#748)
* Wait until cluster is ready before initializing cluster dashboard Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
parent
c31004e677
commit
659d8bd0ab
@ -26,11 +26,8 @@ describe("app start", () => {
|
|||||||
const waitForMinikubeDashboard = async (app: Application) => {
|
const waitForMinikubeDashboard = async (app: Application) => {
|
||||||
await app.client.waitUntilTextExists("pre.kube-auth-out", "Authentication proxy started")
|
await app.client.waitUntilTextExists("pre.kube-auth-out", "Authentication proxy started")
|
||||||
let windowCount = await app.client.getWindowCount()
|
let windowCount = await app.client.getWindowCount()
|
||||||
// wait for webview to appear on window count
|
await app.client.waitForExist(`iframe[name="minikube"]`)
|
||||||
while (windowCount == 1) {
|
await app.client.frame("minikube")
|
||||||
windowCount = await app.client.getWindowCount()
|
|
||||||
}
|
|
||||||
await app.client.windowByIndex(windowCount - 1)
|
|
||||||
await app.client.waitUntilTextExists("span.link-text", "Cluster")
|
await app.client.waitUntilTextExists("span.link-text", "Cluster")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,10 +36,10 @@ describe("app start", () => {
|
|||||||
await app.start()
|
await app.start()
|
||||||
await app.client.waitUntilWindowLoaded()
|
await app.client.waitUntilWindowLoaded()
|
||||||
let windowCount = await app.client.getWindowCount()
|
let windowCount = await app.client.getWindowCount()
|
||||||
while (windowCount > 1) {
|
while (windowCount > 1) { // Wait for splash screen to be closed
|
||||||
windowCount = await app.client.getWindowCount()
|
windowCount = await app.client.getWindowCount()
|
||||||
}
|
}
|
||||||
await app.client.windowByIndex(windowCount - 1)
|
await app.client.windowByIndex(0)
|
||||||
await app.client.waitUntilWindowLoaded()
|
await app.client.waitUntilWindowLoaded()
|
||||||
}, 20000)
|
}, 20000)
|
||||||
|
|
||||||
|
|||||||
@ -27,6 +27,7 @@ export interface ClusterState extends ClusterModel {
|
|||||||
online: boolean;
|
online: boolean;
|
||||||
disconnected: boolean;
|
disconnected: boolean;
|
||||||
accessible: boolean;
|
accessible: boolean;
|
||||||
|
ready: boolean;
|
||||||
failureReason: string;
|
failureReason: string;
|
||||||
nodes: number;
|
nodes: number;
|
||||||
eventCount: number;
|
eventCount: number;
|
||||||
@ -47,6 +48,7 @@ export class Cluster implements ClusterModel {
|
|||||||
protected eventDisposers: Function[] = [];
|
protected eventDisposers: Function[] = [];
|
||||||
|
|
||||||
whenInitialized = when(() => this.initialized);
|
whenInitialized = when(() => this.initialized);
|
||||||
|
whenReady = when(() => this.ready);
|
||||||
|
|
||||||
@observable initialized = false;
|
@observable initialized = false;
|
||||||
@observable contextName: string;
|
@observable contextName: string;
|
||||||
@ -56,6 +58,7 @@ export class Cluster implements ClusterModel {
|
|||||||
@observable kubeProxyUrl: string; // lens-proxy to kube-api url
|
@observable kubeProxyUrl: string; // lens-proxy to kube-api url
|
||||||
@observable online: boolean;
|
@observable online: boolean;
|
||||||
@observable accessible: boolean;
|
@observable accessible: boolean;
|
||||||
|
@observable ready: boolean;
|
||||||
@observable disconnected: boolean;
|
@observable disconnected: boolean;
|
||||||
@observable failureReason: string;
|
@observable failureReason: string;
|
||||||
@observable nodes = 0;
|
@observable nodes = 0;
|
||||||
@ -149,6 +152,7 @@ export class Cluster implements ClusterModel {
|
|||||||
this.disconnected = true;
|
this.disconnected = true;
|
||||||
this.online = false;
|
this.online = false;
|
||||||
this.accessible = false;
|
this.accessible = false;
|
||||||
|
this.ready = false;
|
||||||
this.pushState();
|
this.pushState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,6 +176,7 @@ export class Cluster implements ClusterModel {
|
|||||||
this.refreshEvents(),
|
this.refreshEvents(),
|
||||||
this.refreshAllowedResources(),
|
this.refreshAllowedResources(),
|
||||||
]);
|
]);
|
||||||
|
this.ready = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,6 +375,7 @@ export class Cluster implements ClusterModel {
|
|||||||
initialized: this.initialized,
|
initialized: this.initialized,
|
||||||
apiUrl: this.apiUrl,
|
apiUrl: this.apiUrl,
|
||||||
online: this.online,
|
online: this.online,
|
||||||
|
ready: this.ready,
|
||||||
disconnected: this.disconnected,
|
disconnected: this.disconnected,
|
||||||
accessible: this.accessible,
|
accessible: this.accessible,
|
||||||
failureReason: this.failureReason,
|
failureReason: this.failureReason,
|
||||||
|
|||||||
@ -21,10 +21,10 @@ export async function initView(clusterId: ClusterId) {
|
|||||||
}
|
}
|
||||||
logger.info(`[LENS-VIEW]: init dashboard, clusterId=${clusterId}`)
|
logger.info(`[LENS-VIEW]: init dashboard, clusterId=${clusterId}`)
|
||||||
const cluster = clusterStore.getById(clusterId);
|
const cluster = clusterStore.getById(clusterId);
|
||||||
await cluster.whenInitialized;
|
await cluster.whenReady;
|
||||||
const parentElem = document.getElementById("lens-views");
|
const parentElem = document.getElementById("lens-views");
|
||||||
const iframe = document.createElement("iframe");
|
const iframe = document.createElement("iframe");
|
||||||
iframe.name = cluster.preferences.clusterName;
|
iframe.name = cluster.contextName;
|
||||||
iframe.setAttribute("src", `//${clusterId}.${location.host}`)
|
iframe.setAttribute("src", `//${clusterId}.${location.host}`)
|
||||||
iframe.addEventListener("load", async () => {
|
iframe.addEventListener("load", async () => {
|
||||||
logger.info(`[LENS-VIEW]: loaded from ${iframe.src}`)
|
logger.info(`[LENS-VIEW]: loaded from ${iframe.src}`)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user