mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Got multiple windows open
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
5c64b48849
commit
4b660633dd
@ -11,7 +11,8 @@
|
|||||||
"@material-ui/core": "*",
|
"@material-ui/core": "*",
|
||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
"@types/react-select": "*",
|
"@types/react-select": "*",
|
||||||
"conf": "^7.0.1"
|
"conf": "^7.0.1",
|
||||||
|
"typed-emitter": "^1.3.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": {
|
"@babel/runtime": {
|
||||||
@ -675,6 +676,12 @@
|
|||||||
"integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==",
|
"integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"typed-emitter": {
|
||||||
|
"version": "1.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/typed-emitter/-/typed-emitter-1.3.1.tgz",
|
||||||
|
"integrity": "sha512-2h7utWyXgd2R2u2IuL8B4yu1gqMxbgUj2VS/MGVbFhEVQNJKXoQQoS5CBMh+eW31zFeSmDfEQ3qQf4xy5SlPVQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"uri-js": {
|
"uri-js": {
|
||||||
"version": "4.4.1",
|
"version": "4.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
|
||||||
|
|||||||
@ -665,7 +665,8 @@
|
|||||||
"@material-ui/core": "*",
|
"@material-ui/core": "*",
|
||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
"@types/react-select": "*",
|
"@types/react-select": "*",
|
||||||
"conf": "^7.0.1"
|
"conf": "^7.0.1",
|
||||||
|
"typed-emitter": "^1.3.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": {
|
"@babel/runtime": {
|
||||||
@ -1329,6 +1330,12 @@
|
|||||||
"integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==",
|
"integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"typed-emitter": {
|
||||||
|
"version": "1.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/typed-emitter/-/typed-emitter-1.3.1.tgz",
|
||||||
|
"integrity": "sha512-2h7utWyXgd2R2u2IuL8B4yu1gqMxbgUj2VS/MGVbFhEVQNJKXoQQoS5CBMh+eW31zFeSmDfEQ3qQf4xy5SlPVQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"uri-js": {
|
"uri-js": {
|
||||||
"version": "4.4.1",
|
"version": "4.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
|
||||||
|
|||||||
9
extensions/node-menu/package-lock.json
generated
9
extensions/node-menu/package-lock.json
generated
@ -631,7 +631,8 @@
|
|||||||
"@material-ui/core": "*",
|
"@material-ui/core": "*",
|
||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
"@types/react-select": "*",
|
"@types/react-select": "*",
|
||||||
"conf": "^7.0.1"
|
"conf": "^7.0.1",
|
||||||
|
"typed-emitter": "^1.3.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": {
|
"@babel/runtime": {
|
||||||
@ -1295,6 +1296,12 @@
|
|||||||
"integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==",
|
"integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"typed-emitter": {
|
||||||
|
"version": "1.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/typed-emitter/-/typed-emitter-1.3.1.tgz",
|
||||||
|
"integrity": "sha512-2h7utWyXgd2R2u2IuL8B4yu1gqMxbgUj2VS/MGVbFhEVQNJKXoQQoS5CBMh+eW31zFeSmDfEQ3qQf4xy5SlPVQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"uri-js": {
|
"uri-js": {
|
||||||
"version": "4.4.1",
|
"version": "4.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
|
||||||
|
|||||||
9
extensions/pod-menu/package-lock.json
generated
9
extensions/pod-menu/package-lock.json
generated
@ -631,7 +631,8 @@
|
|||||||
"@material-ui/core": "*",
|
"@material-ui/core": "*",
|
||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
"@types/react-select": "*",
|
"@types/react-select": "*",
|
||||||
"conf": "^7.0.1"
|
"conf": "^7.0.1",
|
||||||
|
"typed-emitter": "^1.3.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": {
|
"@babel/runtime": {
|
||||||
@ -1248,6 +1249,12 @@
|
|||||||
"integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==",
|
"integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"typed-emitter": {
|
||||||
|
"version": "1.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/typed-emitter/-/typed-emitter-1.3.1.tgz",
|
||||||
|
"integrity": "sha512-2h7utWyXgd2R2u2IuL8B4yu1gqMxbgUj2VS/MGVbFhEVQNJKXoQQoS5CBMh+eW31zFeSmDfEQ3qQf4xy5SlPVQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"uri-js": {
|
"uri-js": {
|
||||||
"version": "4.4.1",
|
"version": "4.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
|
||||||
|
|||||||
@ -23,7 +23,7 @@ import { catalogCategoryRegistry } from "../catalog/catalog-category-registry";
|
|||||||
import { CatalogEntity, CatalogEntityActionContext, CatalogEntityAddMenuContext, CatalogEntityContextMenuContext, CatalogEntityMetadata, CatalogEntityStatus } from "../catalog";
|
import { CatalogEntity, CatalogEntityActionContext, CatalogEntityAddMenuContext, CatalogEntityContextMenuContext, CatalogEntityMetadata, CatalogEntityStatus } from "../catalog";
|
||||||
import { clusterActivateHandler, clusterDeleteHandler, clusterDisconnectHandler } from "../cluster-ipc";
|
import { clusterActivateHandler, clusterDeleteHandler, clusterDisconnectHandler } from "../cluster-ipc";
|
||||||
import { ClusterStore } from "../cluster-store";
|
import { ClusterStore } from "../cluster-store";
|
||||||
import { requestMain } from "../ipc";
|
import { onNewWindowForClusterHandler, requestMain } from "../ipc";
|
||||||
import { CatalogCategory, CatalogCategorySpec } from "../catalog";
|
import { CatalogCategory, CatalogCategorySpec } from "../catalog";
|
||||||
import { addClusterURL } from "../routes";
|
import { addClusterURL } from "../routes";
|
||||||
import { app } from "electron";
|
import { app } from "electron";
|
||||||
@ -103,6 +103,19 @@ export class KubernetesCluster extends CatalogEntity<KubernetesClusterMetadata,
|
|||||||
}
|
}
|
||||||
|
|
||||||
async onContextMenuOpen(context: CatalogEntityContextMenuContext) {
|
async onContextMenuOpen(context: CatalogEntityContextMenuContext) {
|
||||||
|
context.menuItems.push(
|
||||||
|
{
|
||||||
|
title: "Open",
|
||||||
|
icon: "open_in_full",
|
||||||
|
onClick: () => this.onRun(context),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Open in new window",
|
||||||
|
icon: "launch",
|
||||||
|
onClick: () => requestMain(onNewWindowForClusterHandler, this.getId()),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
if (!this.metadata.source || this.metadata.source === "local") {
|
if (!this.metadata.source || this.metadata.source === "local") {
|
||||||
context.menuItems.push(
|
context.menuItems.push(
|
||||||
{
|
{
|
||||||
|
|||||||
@ -135,6 +135,7 @@ export interface CatalogEntitySettingsMenu {
|
|||||||
|
|
||||||
export interface CatalogEntityContextMenuContext {
|
export interface CatalogEntityContextMenuContext {
|
||||||
navigate: (url: string) => void;
|
navigate: (url: string) => void;
|
||||||
|
setCommandPaletteContext: (context?: CatalogEntity) => void;
|
||||||
menuItems: CatalogEntityContextMenu[];
|
menuItems: CatalogEntityContextMenu[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,3 +24,5 @@ export * from "./invalid-kubeconfig";
|
|||||||
export * from "./update-available.ipc";
|
export * from "./update-available.ipc";
|
||||||
export * from "./cluster.ipc";
|
export * from "./cluster.ipc";
|
||||||
export * from "./type-enforced-ipc";
|
export * from "./type-enforced-ipc";
|
||||||
|
|
||||||
|
export const onNewWindowForClusterHandler = "window:open-new:cluster";
|
||||||
|
|||||||
@ -156,3 +156,26 @@ export function find<T>(src: Iterable<T>, match: (i: T) => any): T | undefined {
|
|||||||
|
|
||||||
return void 0;
|
return void 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the zero indexed iteration value, or `undefined` if the iterator has finished
|
||||||
|
* @param src A type that can be iterated over
|
||||||
|
* @param index The 0-index number of items to skip before returning
|
||||||
|
*/
|
||||||
|
export function nth<T>(src: Iterable<T>, index: number): T | undefined {
|
||||||
|
const iterator = src[Symbol.iterator]();
|
||||||
|
|
||||||
|
for (let i = 0; i < index; i += 1) {
|
||||||
|
iterator.next();
|
||||||
|
}
|
||||||
|
|
||||||
|
return iterator.next().value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A special cased version of `nth`.
|
||||||
|
* @param src A type that can be iterated over
|
||||||
|
*/
|
||||||
|
export function first<T>(src: Iterable<T>): T | undefined {
|
||||||
|
return src[Symbol.iterator]().next().value;
|
||||||
|
}
|
||||||
|
|||||||
@ -60,6 +60,8 @@ import { WeblinkStore } from "../common/weblink-store";
|
|||||||
import { ExtensionsStore } from "../extensions/extensions-store";
|
import { ExtensionsStore } from "../extensions/extensions-store";
|
||||||
import { FilesystemProvisionerStore } from "./extension-filesystem";
|
import { FilesystemProvisionerStore } from "./extension-filesystem";
|
||||||
import { SentryInit } from "../common/sentry";
|
import { SentryInit } from "../common/sentry";
|
||||||
|
import { initMenu } from "./menu";
|
||||||
|
import { initTray } from "./tray";
|
||||||
|
|
||||||
// This has to be called before start using winton-based logger
|
// This has to be called before start using winton-based logger
|
||||||
// For example, before any logger.log
|
// For example, before any logger.log
|
||||||
@ -115,7 +117,7 @@ app.on("second-instance", (event, argv) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WindowManager.getInstance(false)?.ensureMainWindow();
|
WindowManager.getInstance(false)?.ensureWindow();
|
||||||
});
|
});
|
||||||
|
|
||||||
app.on("ready", async () => {
|
app.on("ready", async () => {
|
||||||
@ -207,9 +209,12 @@ app.on("ready", async () => {
|
|||||||
installDeveloperTools();
|
installDeveloperTools();
|
||||||
|
|
||||||
if (!startHidden) {
|
if (!startHidden) {
|
||||||
windowManager.ensureMainWindow();
|
windowManager.ensureWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initMenu(windowManager);
|
||||||
|
initTray(windowManager);
|
||||||
|
|
||||||
ipcMainOn(IpcRendererNavigationEvents.LOADED, () => {
|
ipcMainOn(IpcRendererNavigationEvents.LOADED, () => {
|
||||||
cleanup.push(pushCatalogToRenderer(catalogEntityRegistry));
|
cleanup.push(pushCatalogToRenderer(catalogEntityRegistry));
|
||||||
KubeconfigSyncManager.getInstance().startSync();
|
KubeconfigSyncManager.getInstance().startSync();
|
||||||
@ -251,7 +256,7 @@ app.on("activate", (event, hasVisibleWindows) => {
|
|||||||
logger.info("APP:ACTIVATE", { hasVisibleWindows });
|
logger.info("APP:ACTIVATE", { hasVisibleWindows });
|
||||||
|
|
||||||
if (!hasVisibleWindows) {
|
if (!hasVisibleWindows) {
|
||||||
WindowManager.getInstance(false)?.ensureMainWindow(false);
|
WindowManager.getInstance(false)?.ensureWindow();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -25,13 +25,15 @@ import { clusterFrameMap } from "../../common/cluster-frames";
|
|||||||
import { clusterActivateHandler, clusterSetFrameIdHandler, clusterVisibilityHandler, clusterRefreshHandler, clusterDisconnectHandler, clusterKubectlApplyAllHandler, clusterKubectlDeleteAllHandler, clusterDeleteHandler } from "../../common/cluster-ipc";
|
import { clusterActivateHandler, clusterSetFrameIdHandler, clusterVisibilityHandler, clusterRefreshHandler, clusterDisconnectHandler, clusterKubectlApplyAllHandler, clusterKubectlDeleteAllHandler, clusterDeleteHandler } from "../../common/cluster-ipc";
|
||||||
import { ClusterId, ClusterStore } from "../../common/cluster-store";
|
import { ClusterId, ClusterStore } from "../../common/cluster-store";
|
||||||
import { appEventBus } from "../../common/event-bus";
|
import { appEventBus } from "../../common/event-bus";
|
||||||
import { ipcMainHandle } from "../../common/ipc";
|
import { ipcMainHandle, onNewWindowForClusterHandler } from "../../common/ipc";
|
||||||
|
import { IpcRendererNavigationEvents } from "../../renderer/navigation/events";
|
||||||
import { catalogEntityRegistry } from "../catalog";
|
import { catalogEntityRegistry } from "../catalog";
|
||||||
import { ClusterManager } from "../cluster-manager";
|
import { ClusterManager } from "../cluster-manager";
|
||||||
import { bundledKubectlPath } from "../kubectl";
|
import { bundledKubectlPath } from "../kubectl";
|
||||||
import logger from "../logger";
|
import logger from "../logger";
|
||||||
import { promiseExecFile } from "../promise-exec";
|
import { promiseExecFile } from "../promise-exec";
|
||||||
import { ResourceApplier } from "../resource-applier";
|
import { ResourceApplier } from "../resource-applier";
|
||||||
|
import { WindowManager } from "../window-manager";
|
||||||
|
|
||||||
export function initIpcMainHandlers() {
|
export function initIpcMainHandlers() {
|
||||||
ipcMainHandle(clusterActivateHandler, (event, clusterId: ClusterId, force = false) => {
|
ipcMainHandle(clusterActivateHandler, (event, clusterId: ClusterId, force = false) => {
|
||||||
@ -137,4 +139,24 @@ export function initIpcMainHandlers() {
|
|||||||
throw `${clusterId} is not a valid cluster id`;
|
throw `${clusterId} is not a valid cluster id`;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcMainHandle(onNewWindowForClusterHandler, async (event, clusterId: ClusterId) => {
|
||||||
|
appEventBus.emit({ name: "cluster", action: "open-new-window" });
|
||||||
|
const cluster = ClusterStore.getInstance().getById(clusterId);
|
||||||
|
|
||||||
|
if (!cluster) {
|
||||||
|
return void logger.info("Cannot open clutser in new window, unknown cluster Id", { clusterId });
|
||||||
|
}
|
||||||
|
|
||||||
|
const wm = WindowManager.getInstance();
|
||||||
|
|
||||||
|
try {
|
||||||
|
console.log("trying to opening new window", event);
|
||||||
|
const window = await wm.openNewWindow();
|
||||||
|
|
||||||
|
window.webContents.send(IpcRendererNavigationEvents.NAVIGATE_IN_APP, `/cluster/${clusterId}`);
|
||||||
|
} catch (error) {
|
||||||
|
logger.error("Failed to load url for new cluster window", error);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -81,7 +81,7 @@ export class LensProtocolRouterMain extends proto.LensProtocolRouter {
|
|||||||
throw new proto.RoutingError(proto.RoutingErrorType.INVALID_PROTOCOL, url);
|
throw new proto.RoutingError(proto.RoutingErrorType.INVALID_PROTOCOL, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
WindowManager.getInstance(false)?.ensureMainWindow().catch(noop);
|
WindowManager.getInstance(false)?.ensureWindow().catch(noop);
|
||||||
const routeInternally = checkHost(url);
|
const routeInternally = checkHost(url);
|
||||||
|
|
||||||
logger.info(`${proto.LensProtocolRouter.LoggingPrefix}: routing ${url.toString()}`);
|
logger.info(`${proto.LensProtocolRouter.LoggingPrefix}: routing ${url.toString()}`);
|
||||||
|
|||||||
@ -54,7 +54,7 @@ export function initTray(windowManager: WindowManager) {
|
|||||||
if (isWindows) {
|
if (isWindows) {
|
||||||
tray.on("click", () => {
|
tray.on("click", () => {
|
||||||
windowManager
|
windowManager
|
||||||
.ensureMainWindow()
|
.ensureWindow()
|
||||||
.catch(error => logger.error(`${TRAY_LOG_PREFIX}: Failed to open lens`, { error }));
|
.catch(error => logger.error(`${TRAY_LOG_PREFIX}: Failed to open lens`, { error }));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -84,7 +84,7 @@ function createTrayMenu(windowManager: WindowManager): Menu {
|
|||||||
label: `Open ${productName}`,
|
label: `Open ${productName}`,
|
||||||
click() {
|
click() {
|
||||||
windowManager
|
windowManager
|
||||||
.ensureMainWindow()
|
.ensureWindow()
|
||||||
.catch(error => logger.error(`${TRAY_LOG_PREFIX}: Failed to open lens`, { error }));
|
.catch(error => logger.error(`${TRAY_LOG_PREFIX}: Failed to open lens`, { error }));
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -103,7 +103,7 @@ function createTrayMenu(windowManager: WindowManager): Menu {
|
|||||||
label: "Check for updates",
|
label: "Check for updates",
|
||||||
click() {
|
click() {
|
||||||
checkForUpdates()
|
checkForUpdates()
|
||||||
.then(() => windowManager.ensureMainWindow());
|
.then(() => windowManager.ensureWindow());
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -112,7 +112,7 @@ function createTrayMenu(windowManager: WindowManager): Menu {
|
|||||||
{
|
{
|
||||||
label: `About ${productName}`,
|
label: `About ${productName}`,
|
||||||
click() {
|
click() {
|
||||||
windowManager.ensureMainWindow()
|
windowManager.ensureWindow()
|
||||||
.then(showAbout)
|
.then(showAbout)
|
||||||
.catch(error => logger.error(`${TRAY_LOG_PREFIX}: Failed to show Lens About view`, { error }));
|
.catch(error => logger.error(`${TRAY_LOG_PREFIX}: Failed to show Lens About view`, { error }));
|
||||||
},
|
},
|
||||||
|
|||||||
@ -19,20 +19,16 @@
|
|||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { ClusterId } from "../common/cluster-store";
|
|
||||||
import { makeObservable, observable } from "mobx";
|
|
||||||
import { app, BrowserWindow, dialog, ipcMain, shell, webContents } from "electron";
|
import { app, BrowserWindow, dialog, ipcMain, shell, webContents } from "electron";
|
||||||
import windowStateKeeper from "electron-window-state";
|
import windowStateKeeper from "electron-window-state";
|
||||||
import { appEventBus } from "../common/event-bus";
|
import { appEventBus } from "../common/event-bus";
|
||||||
import { ipcMainOn } from "../common/ipc";
|
|
||||||
import { initMenu } from "./menu";
|
|
||||||
import { initTray } from "./tray";
|
|
||||||
import { delay, iter, Singleton } from "../common/utils";
|
import { delay, iter, Singleton } from "../common/utils";
|
||||||
import { ClusterFrameInfo, clusterFrameMap } from "../common/cluster-frames";
|
import { ClusterFrameInfo, clusterFrameMap } from "../common/cluster-frames";
|
||||||
import { IpcRendererNavigationEvents } from "../renderer/navigation/events";
|
import { IpcRendererNavigationEvents } from "../renderer/navigation/events";
|
||||||
import logger from "./logger";
|
import logger from "./logger";
|
||||||
import { productName } from "../common/vars";
|
import { productName } from "../common/vars";
|
||||||
import { LensProxy } from "./proxy/lens-proxy";
|
import { LensProxy } from "./proxy/lens-proxy";
|
||||||
|
import { reaction } from "mobx";
|
||||||
|
|
||||||
function isHideable(window: BrowserWindow | null): boolean {
|
function isHideable(window: BrowserWindow | null): boolean {
|
||||||
return Boolean(window && !window.isDestroyed());
|
return Boolean(window && !window.isDestroyed());
|
||||||
@ -45,156 +41,185 @@ export interface SendToViewArgs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class WindowManager extends Singleton {
|
export class WindowManager extends Singleton {
|
||||||
protected mainWindow: BrowserWindow;
|
|
||||||
protected splashWindow: BrowserWindow;
|
protected splashWindow: BrowserWindow;
|
||||||
protected windowState: windowStateKeeper.State;
|
protected windows = new Map<number, [BrowserWindow, windowStateKeeper.State]>();
|
||||||
protected disposers: Record<string, Function> = {};
|
|
||||||
|
|
||||||
@observable activeClusterId: ClusterId;
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
makeObservable(this);
|
|
||||||
this.bindEvents();
|
reaction(() => this.windows.size, windowCount => {
|
||||||
this.initMenu();
|
// show icon in dock (mac-os only)
|
||||||
this.initTray();
|
if (windowCount) {
|
||||||
|
app.dock?.show();
|
||||||
|
} else {
|
||||||
|
app.dock?.hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
get mainUrl() {
|
get mainUrl() {
|
||||||
return `http://localhost:${LensProxy.getInstance().port}`;
|
return `http://localhost:${LensProxy.getInstance().port}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async initMainWindow(showSplash: boolean) {
|
private async createNewWindow(): Promise<BrowserWindow> {
|
||||||
// Manage main window size and position with state persistence
|
const windowState = windowStateKeeper({
|
||||||
if (!this.windowState) {
|
defaultHeight: 900,
|
||||||
this.windowState = windowStateKeeper({
|
defaultWidth: 1440,
|
||||||
defaultHeight: 900,
|
});
|
||||||
defaultWidth: 1440,
|
const { width, height, x, y } = windowState;
|
||||||
|
const browserWindow = new BrowserWindow({
|
||||||
|
x, y, width, height,
|
||||||
|
title: productName,
|
||||||
|
show: false,
|
||||||
|
minWidth: 700, // accommodate 800 x 600 display minimum
|
||||||
|
minHeight: 500, // accommodate 800 x 600 display minimum
|
||||||
|
titleBarStyle: "hidden",
|
||||||
|
backgroundColor: "#1e2124",
|
||||||
|
webPreferences: {
|
||||||
|
nodeIntegration: true,
|
||||||
|
nodeIntegrationInSubFrames: true,
|
||||||
|
enableRemoteModule: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const windowId = browserWindow.webContents.getProcessId();
|
||||||
|
|
||||||
|
windowState.manage(browserWindow);
|
||||||
|
this.windows.set(windowId, [browserWindow, windowState]);
|
||||||
|
|
||||||
|
browserWindow
|
||||||
|
.on("focus", () => appEventBus.emit({ name: "app", action: "focus" }))
|
||||||
|
.on("blur", () => appEventBus.emit({ name: "app", action: "blur" }))
|
||||||
|
.on("closed", () => {
|
||||||
|
// clean up
|
||||||
|
windowState.unmanage();
|
||||||
|
this.windows.delete(windowId);
|
||||||
|
|
||||||
|
this.splashWindow = null;
|
||||||
|
})
|
||||||
|
.webContents
|
||||||
|
.on("new-window", (event, url) => {
|
||||||
|
event.preventDefault();
|
||||||
|
shell.openExternal(url);
|
||||||
|
})
|
||||||
|
.on("dom-ready", () => appEventBus.emit({ name: "app", action: "dom-ready" }))
|
||||||
|
.on("did-fail-load", (_event, code, desc) => {
|
||||||
|
logger.error(`[WINDOW-MANAGER]: Failed to load window`, { windowId, code, desc });
|
||||||
|
})
|
||||||
|
.on("did-finish-load", () => {
|
||||||
|
logger.info("[WINDOW-MANAGER]: Window emitted did-finish-load", { windowId });
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.mainWindow) {
|
return browserWindow;
|
||||||
// show icon in dock (mac-os only)
|
}
|
||||||
app.dock?.show();
|
|
||||||
|
|
||||||
const { width, height, x, y } = this.windowState;
|
public async openNewWindow(): Promise<BrowserWindow> {
|
||||||
|
const browserWindow = await this.createNewWindow();
|
||||||
this.mainWindow = new BrowserWindow({
|
const windowId = browserWindow.webContents.getProcessId();
|
||||||
x, y, width, height,
|
|
||||||
title: productName,
|
|
||||||
show: false,
|
|
||||||
minWidth: 700, // accommodate 800 x 600 display minimum
|
|
||||||
minHeight: 500, // accommodate 800 x 600 display minimum
|
|
||||||
titleBarStyle: "hidden",
|
|
||||||
backgroundColor: "#1e2124",
|
|
||||||
webPreferences: {
|
|
||||||
nodeIntegration: true,
|
|
||||||
nodeIntegrationInSubFrames: true,
|
|
||||||
enableRemoteModule: true,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
this.windowState.manage(this.mainWindow);
|
|
||||||
|
|
||||||
// open external links in default browser (target=_blank, window.open)
|
|
||||||
this.mainWindow
|
|
||||||
.on("focus", () => {
|
|
||||||
appEventBus.emit({ name: "app", action: "focus" });
|
|
||||||
})
|
|
||||||
.on("blur", () => {
|
|
||||||
appEventBus.emit({ name: "app", action: "blur" });
|
|
||||||
})
|
|
||||||
.on("closed", () => {
|
|
||||||
// clean up
|
|
||||||
this.windowState.unmanage();
|
|
||||||
this.mainWindow = null;
|
|
||||||
this.splashWindow = null;
|
|
||||||
app.dock?.hide(); // hide icon in dock (mac-os)
|
|
||||||
})
|
|
||||||
.webContents
|
|
||||||
.on("new-window", (event, url) => {
|
|
||||||
event.preventDefault();
|
|
||||||
shell.openExternal(url);
|
|
||||||
})
|
|
||||||
.on("dom-ready", () => {
|
|
||||||
appEventBus.emit({ name: "app", action: "dom-ready" });
|
|
||||||
})
|
|
||||||
.on("did-fail-load", (_event, code, desc) => {
|
|
||||||
logger.error(`[WINDOW-MANAGER]: Failed to load Main window`, { code, desc });
|
|
||||||
})
|
|
||||||
.on("did-finish-load", () => {
|
|
||||||
logger.info("[WINDOW-MANAGER]: Main window loaded");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (showSplash) await this.showSplash();
|
if (!this.hasVisibleWindow()) {
|
||||||
logger.info(`[WINDOW-MANAGER]: Loading Main window from url: ${this.mainUrl} ...`);
|
await this.showSplash();
|
||||||
await this.mainWindow.loadURL(this.mainUrl);
|
}
|
||||||
|
|
||||||
|
console.log(this.windows);
|
||||||
|
|
||||||
|
logger.info(`[WINDOW-MANAGER]: Loading window from url: ${this.mainUrl} ...`, { windowId });
|
||||||
|
|
||||||
|
const viewHasLoaded = new Promise<void>(resolve => {
|
||||||
|
const listener = (event: Electron.IpcMainEvent): void => {
|
||||||
|
if (event.sender.getProcessId() === browserWindow.webContents.getProcessId()) {
|
||||||
|
resolve();
|
||||||
|
ipcMain.off(IpcRendererNavigationEvents.LOADED, listener);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ipcMain.on(IpcRendererNavigationEvents.LOADED, listener);
|
||||||
|
});
|
||||||
|
|
||||||
|
await browserWindow.loadURL(this.mainUrl);
|
||||||
|
await viewHasLoaded;
|
||||||
|
|
||||||
|
browserWindow.show();
|
||||||
|
this.splashWindow?.close();
|
||||||
|
this.splashWindow = undefined;
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
appEventBus.emit({ name: "app", action: "start" });
|
||||||
|
}, 1000);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error("Loading main window failed", { error });
|
logger.error("Loading window failed", { windowId, error });
|
||||||
dialog.showErrorBox("ERROR!", error.toString());
|
dialog.showErrorBox("ERROR!", error.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return browserWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async initMenu() {
|
async ensureWindow(): Promise<BrowserWindow> {
|
||||||
this.disposers.menuAutoUpdater = initMenu(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected initTray() {
|
|
||||||
this.disposers.trayAutoUpdater = initTray(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected bindEvents() {
|
|
||||||
// track visible cluster from ui
|
|
||||||
ipcMainOn(IpcRendererNavigationEvents.CLUSTER_VIEW_CURRENT_ID, (event, clusterId: ClusterId) => {
|
|
||||||
this.activeClusterId = clusterId;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async ensureMainWindow(showSplash = true): Promise<BrowserWindow> {
|
|
||||||
// This needs to be ready to hear the IPC message before the window is loaded
|
// This needs to be ready to hear the IPC message before the window is loaded
|
||||||
let viewHasLoaded = Promise.resolve();
|
let viewHasLoaded = Promise.resolve();
|
||||||
|
let browserWindow: BrowserWindow;
|
||||||
|
|
||||||
if (!this.mainWindow) {
|
if (this.windows.size === 0) {
|
||||||
viewHasLoaded = new Promise<void>(resolve => {
|
viewHasLoaded = new Promise<void>(resolve => {
|
||||||
ipcMain.once(IpcRendererNavigationEvents.LOADED, () => resolve());
|
ipcMain.once(IpcRendererNavigationEvents.LOADED, () => resolve());
|
||||||
});
|
});
|
||||||
await this.initMainWindow(showSplash);
|
|
||||||
|
browserWindow = await this.openNewWindow();
|
||||||
|
|
||||||
|
try {
|
||||||
|
await this.showSplash();
|
||||||
|
logger.info(`[WINDOW-MANAGER]: Loading window from url: ${this.mainUrl} ...`, { windowId: browserWindow.webContents.getProcessId() });
|
||||||
|
await browserWindow.loadURL(this.mainUrl);
|
||||||
|
} catch (error) {
|
||||||
|
logger.error("Loading window failed", { error });
|
||||||
|
dialog.showErrorBox("ERROR!", error.toString());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
browserWindow = iter.first(this.windows.values())[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await viewHasLoaded;
|
await viewHasLoaded;
|
||||||
await delay(50); // wait just a bit longer to let the first round of rendering happen
|
await delay(50); // wait just a bit longer to let the first round of rendering happen
|
||||||
logger.info("[WINDOW-MANAGER]: Main window has reported that it has loaded");
|
logger.info("[WINDOW-MANAGER]: Window has reported that it has loaded", { windowId: browserWindow.webContents.getProcessId() });
|
||||||
|
|
||||||
this.mainWindow.show();
|
browserWindow.show();
|
||||||
this.splashWindow?.close();
|
this.splashWindow?.close();
|
||||||
this.splashWindow = undefined;
|
this.splashWindow = undefined;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
appEventBus.emit({ name: "app", action: "start" });
|
appEventBus.emit({ name: "app", action: "start" });
|
||||||
}, 1000);
|
}, 1000);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(`Showing main window failed: ${error.stack || error}`);
|
logger.error(`Showing window failed: ${error.stack || error}`);
|
||||||
dialog.showErrorBox("ERROR!", error.toString());
|
dialog.showErrorBox("ERROR!", error.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.mainWindow;
|
return browserWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
private sendToView({ channel, frameInfo, data = [] }: SendToViewArgs) {
|
public hasVisibleWindow(): boolean {
|
||||||
|
for (const [window] of this.windows.values()) {
|
||||||
|
if (window.isVisible()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private sendToView(browserWindow: BrowserWindow, { channel, frameInfo, data = [] }: SendToViewArgs) {
|
||||||
if (frameInfo) {
|
if (frameInfo) {
|
||||||
this.mainWindow.webContents.sendToFrame([frameInfo.processId, frameInfo.frameId], channel, ...data);
|
browserWindow.webContents.sendToFrame([frameInfo.processId, frameInfo.frameId], channel, ...data);
|
||||||
} else {
|
} else {
|
||||||
this.mainWindow.webContents.send(channel, ...data);
|
browserWindow.webContents.send(channel, ...data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async navigateExtension(extId: string, pageId?: string, params?: Record<string, any>, frameId?: number) {
|
async navigateExtension(extId: string, pageId?: string, params?: Record<string, any>, frameId?: number) {
|
||||||
await this.ensureMainWindow();
|
const browserWindow = await this.ensureWindow();
|
||||||
|
|
||||||
const frameInfo = iter.find(clusterFrameMap.values(), frameInfo => frameInfo.frameId === frameId);
|
const frameInfo = iter.find(clusterFrameMap.values(), frameInfo => frameInfo.frameId === frameId);
|
||||||
|
|
||||||
this.sendToView({
|
this.sendToView(browserWindow, {
|
||||||
channel: "extension:navigate",
|
channel: "extension:navigate",
|
||||||
frameInfo,
|
frameInfo,
|
||||||
data: [extId, pageId, params],
|
data: [extId, pageId, params],
|
||||||
@ -202,14 +227,13 @@ export class WindowManager extends Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async navigate(url: string, frameId?: number) {
|
async navigate(url: string, frameId?: number) {
|
||||||
await this.ensureMainWindow();
|
const browserWindow = await this.ensureWindow();
|
||||||
|
|
||||||
const frameInfo = iter.find(clusterFrameMap.values(), frameInfo => frameInfo.frameId === frameId);
|
const frameInfo = iter.find(clusterFrameMap.values(), frameInfo => frameInfo.frameId === frameId);
|
||||||
const channel = frameInfo
|
const channel = frameInfo
|
||||||
? IpcRendererNavigationEvents.NAVIGATE_IN_CLUSTER
|
? IpcRendererNavigationEvents.NAVIGATE_IN_CLUSTER
|
||||||
: IpcRendererNavigationEvents.NAVIGATE_IN_APP;
|
: IpcRendererNavigationEvents.NAVIGATE_IN_APP;
|
||||||
|
|
||||||
this.sendToView({
|
this.sendToView(browserWindow, {
|
||||||
channel,
|
channel,
|
||||||
frameInfo,
|
frameInfo,
|
||||||
data: [url],
|
data: [url],
|
||||||
@ -217,16 +241,10 @@ export class WindowManager extends Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
reload() {
|
reload() {
|
||||||
const frameInfo = clusterFrameMap.get(this.activeClusterId);
|
webContents.getFocusedWebContents()?.reload();
|
||||||
|
|
||||||
if (frameInfo) {
|
|
||||||
this.sendToView({ channel: IpcRendererNavigationEvents.RELOAD_PAGE, frameInfo });
|
|
||||||
} else {
|
|
||||||
webContents.getFocusedWebContents()?.reload();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async showSplash() {
|
private async showSplash() {
|
||||||
if (!this.splashWindow) {
|
if (!this.splashWindow) {
|
||||||
this.splashWindow = new BrowserWindow({
|
this.splashWindow = new BrowserWindow({
|
||||||
width: 500,
|
width: 500,
|
||||||
@ -246,8 +264,10 @@ export class WindowManager extends Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
hide() {
|
hide() {
|
||||||
if (isHideable(this.mainWindow)) {
|
for (const [window] of this.windows.values()) {
|
||||||
this.mainWindow.hide();
|
if (isHideable(window)) {
|
||||||
|
window.hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isHideable(this.splashWindow)) {
|
if (isHideable(this.splashWindow)) {
|
||||||
@ -256,13 +276,13 @@ export class WindowManager extends Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
this.mainWindow.destroy();
|
for (const [window, manager] of this.windows.values()) {
|
||||||
|
manager.unmanage();
|
||||||
|
window.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.windows.clear();
|
||||||
this.splashWindow.destroy();
|
this.splashWindow.destroy();
|
||||||
this.mainWindow = null;
|
|
||||||
this.splashWindow = null;
|
this.splashWindow = null;
|
||||||
Object.entries(this.disposers).forEach(([name, dispose]) => {
|
|
||||||
dispose();
|
|
||||||
delete this.disposers[name];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,6 +31,7 @@ import { ConfirmDialog } from "../confirm-dialog";
|
|||||||
import { HotbarStore } from "../../../common/hotbar-store";
|
import { HotbarStore } from "../../../common/hotbar-store";
|
||||||
import { Icon } from "../icon";
|
import { Icon } from "../icon";
|
||||||
import type { CatalogEntityItem } from "./catalog-entity.store";
|
import type { CatalogEntityItem } from "./catalog-entity.store";
|
||||||
|
import { catalogEntityRegistry } from "../../api/catalog-entity-registry";
|
||||||
|
|
||||||
export interface CatalogEntityDrawerMenuProps<T extends CatalogEntity> extends MenuActionsProps {
|
export interface CatalogEntityDrawerMenuProps<T extends CatalogEntity> extends MenuActionsProps {
|
||||||
item: CatalogEntityItem<T> | null | undefined;
|
item: CatalogEntityItem<T> | null | undefined;
|
||||||
@ -49,6 +50,9 @@ export class CatalogEntityDrawerMenu<T extends CatalogEntity> extends React.Comp
|
|||||||
this.contextMenu = {
|
this.contextMenu = {
|
||||||
menuItems: [],
|
menuItems: [],
|
||||||
navigate: (url: string) => navigate(url),
|
navigate: (url: string) => navigate(url),
|
||||||
|
setCommandPaletteContext: (entity: CatalogEntity) => {
|
||||||
|
catalogEntityRegistry.activeEntity = entity;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
this.props.item?.onContextMenuOpen(this.contextMenu);
|
this.props.item?.onContextMenuOpen(this.contextMenu);
|
||||||
}
|
}
|
||||||
@ -109,7 +113,7 @@ export class CatalogEntityDrawerMenu<T extends CatalogEntity> extends React.Comp
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { className, item: entity, ...menuProps } = this.props;
|
const { className, item: entity, ...menuProps } = this.props;
|
||||||
|
|
||||||
if (!this.contextMenu || !entity.enabled) {
|
if (!this.contextMenu || !entity.enabled) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,6 +44,7 @@ import { CatalogMenu } from "./catalog-menu";
|
|||||||
import { HotbarIcon } from "../hotbar/hotbar-icon";
|
import { HotbarIcon } from "../hotbar/hotbar-icon";
|
||||||
import { RenderDelay } from "../render-delay/render-delay";
|
import { RenderDelay } from "../render-delay/render-delay";
|
||||||
import { CatalogTopbar } from "../cluster-manager/catalog-topbar";
|
import { CatalogTopbar } from "../cluster-manager/catalog-topbar";
|
||||||
|
import { catalogEntityRegistry } from "../../api/catalog-entity-registry";
|
||||||
|
|
||||||
export const previousActiveTab = createAppStorage("catalog-previous-active-tab", "");
|
export const previousActiveTab = createAppStorage("catalog-previous-active-tab", "");
|
||||||
|
|
||||||
@ -83,6 +84,9 @@ export class Catalog extends React.Component<Props> {
|
|||||||
this.contextMenu = {
|
this.contextMenu = {
|
||||||
menuItems: observable.array([]),
|
menuItems: observable.array([]),
|
||||||
navigate: (url: string) => navigate(url),
|
navigate: (url: string) => navigate(url),
|
||||||
|
setCommandPaletteContext: (entity: CatalogEntity) => {
|
||||||
|
catalogEntityRegistry.activeEntity = entity;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
disposeOnUnmount(this, [
|
disposeOnUnmount(this, [
|
||||||
this.catalogEntityStore.watch(),
|
this.catalogEntityStore.watch(),
|
||||||
|
|||||||
@ -55,6 +55,9 @@ export class HotbarEntityIcon extends React.Component<Props> {
|
|||||||
this.contextMenu = {
|
this.contextMenu = {
|
||||||
menuItems: [],
|
menuItems: [],
|
||||||
navigate: (url: string) => navigate(url),
|
navigate: (url: string) => navigate(url),
|
||||||
|
setCommandPaletteContext: (entity: CatalogEntity) => {
|
||||||
|
catalogEntityRegistry.activeEntity = entity;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -37,8 +37,16 @@ import { ipcRenderer } from "electron";
|
|||||||
import { IpcRendererNavigationEvents } from "./navigation/events";
|
import { IpcRendererNavigationEvents } from "./navigation/events";
|
||||||
import { catalogEntityRegistry } from "./api/catalog-entity-registry";
|
import { catalogEntityRegistry } from "./api/catalog-entity-registry";
|
||||||
|
|
||||||
|
interface LensAppState {
|
||||||
|
mounted: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class LensApp extends React.Component {
|
export class LensApp extends React.Component<{}, LensAppState> {
|
||||||
|
state = {
|
||||||
|
mounted: false
|
||||||
|
};
|
||||||
|
|
||||||
static async init() {
|
static async init() {
|
||||||
catalogEntityRegistry.init();
|
catalogEntityRegistry.init();
|
||||||
ExtensionLoader.getInstance().loadOnClusterManagerRenderer();
|
ExtensionLoader.getInstance().loadOnClusterManagerRenderer();
|
||||||
@ -52,7 +60,15 @@ export class LensApp extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
ipcRenderer.send(IpcRendererNavigationEvents.LOADED);
|
this.setState({ mounted: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidUpdate() {
|
||||||
|
console.log(process);
|
||||||
|
|
||||||
|
if (this.state.mounted) {
|
||||||
|
ipcRenderer.send(IpcRendererNavigationEvents.LOADED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user