mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
change over cluster actions and loaded events
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
08bff81bf3
commit
b173d758f2
@ -29,6 +29,7 @@ import { LensProtocolRouterMain } from "./protocol-handler";
|
|||||||
import { getAppVersion, getAppVersionFromProxyServer } from "../common/utils";
|
import { getAppVersion, getAppVersionFromProxyServer } from "../common/utils";
|
||||||
import { bindBroadcastHandlers } from "../common/ipc";
|
import { bindBroadcastHandlers } from "../common/ipc";
|
||||||
import { startUpdateChecking } from "./app-updater";
|
import { startUpdateChecking } from "./app-updater";
|
||||||
|
import { IpcRendererNavigationEvents } from "../renderer/navigation/events";
|
||||||
|
|
||||||
const workingDir = path.join(app.getPath("appData"), appName);
|
const workingDir = path.join(app.getPath("appData"), appName);
|
||||||
let proxyPort: number;
|
let proxyPort: number;
|
||||||
@ -162,7 +163,7 @@ app.on("ready", async () => {
|
|||||||
windowManager.initMainWindow();
|
windowManager.initMainWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
ipcMain.on("renderer:loaded", () => {
|
ipcMain.on(IpcRendererNavigationEvents.LOADED, () => {
|
||||||
startUpdateChecking();
|
startUpdateChecking();
|
||||||
LensProtocolRouterMain
|
LensProtocolRouterMain
|
||||||
.getInstance<LensProtocolRouterMain>()
|
.getInstance<LensProtocolRouterMain>()
|
||||||
|
|||||||
@ -9,9 +9,10 @@ import { clusterDisconnectHandler } from "../../../common/cluster-ipc";
|
|||||||
import { ConfirmDialog } from "../confirm-dialog";
|
import { ConfirmDialog } from "../confirm-dialog";
|
||||||
import { Cluster } from "../../../main/cluster";
|
import { Cluster } from "../../../main/cluster";
|
||||||
import { Tooltip } from "../../components//tooltip";
|
import { Tooltip } from "../../components//tooltip";
|
||||||
|
import { IpcRendererNavigationEvents } from "../../navigation/events";
|
||||||
|
|
||||||
const navigate = (route: string) =>
|
const navigate = (route: string) =>
|
||||||
broadcastMessage("renderer:navigate", route);
|
broadcastMessage(IpcRendererNavigationEvents.NAVIGATE_IN_APP, route);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates handlers for high-level actions
|
* Creates handlers for high-level actions
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import { workspaceStore } from "../../../../common/workspace-store";
|
|||||||
import { broadcastMessage, requestMain } from "../../../../common/ipc";
|
import { broadcastMessage, requestMain } from "../../../../common/ipc";
|
||||||
import { clusterDisconnectHandler } from "../../../../common/cluster-ipc";
|
import { clusterDisconnectHandler } from "../../../../common/cluster-ipc";
|
||||||
import { ConfirmDialog } from "../../confirm-dialog";
|
import { ConfirmDialog } from "../../confirm-dialog";
|
||||||
|
import { IpcRendererNavigationEvents } from "../../../navigation/events";
|
||||||
|
|
||||||
const mockBroadcastIpc = broadcastMessage as jest.MockedFunction<typeof broadcastMessage>;
|
const mockBroadcastIpc = broadcastMessage as jest.MockedFunction<typeof broadcastMessage>;
|
||||||
const mockRequestMain = requestMain as jest.MockedFunction<typeof requestMain>;
|
const mockRequestMain = requestMain as jest.MockedFunction<typeof requestMain>;
|
||||||
@ -76,7 +77,7 @@ describe("<MainLayoutHeader />", () => {
|
|||||||
|
|
||||||
it("navigates to cluster settings", () => {
|
it("navigates to cluster settings", () => {
|
||||||
fireEvent.click(settingsBtn);
|
fireEvent.click(settingsBtn);
|
||||||
expect(mockBroadcastIpc).toBeCalledWith("renderer:navigate", "/cluster/foo/settings");
|
expect(mockBroadcastIpc).toBeCalledWith(IpcRendererNavigationEvents.NAVIGATE_IN_APP, "/cluster/foo/settings");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("disconnects from cluster", () => {
|
it("disconnects from cluster", () => {
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import { CommandContainer } from "./components/command-palette/command-container
|
|||||||
import { LensProtocolRouterRenderer, bindProtocolAddRouteHandlers } from "./protocol-handler";
|
import { LensProtocolRouterRenderer, bindProtocolAddRouteHandlers } from "./protocol-handler";
|
||||||
import { registerIpcHandlers } from "./ipc";
|
import { registerIpcHandlers } from "./ipc";
|
||||||
import { ipcRenderer } from "electron";
|
import { ipcRenderer } from "electron";
|
||||||
|
import { IpcRendererNavigationEvents } from "./navigation/events";
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class LensApp extends React.Component {
|
export class LensApp extends React.Component {
|
||||||
@ -30,7 +31,7 @@ export class LensApp extends React.Component {
|
|||||||
});
|
});
|
||||||
|
|
||||||
registerIpcHandlers();
|
registerIpcHandlers();
|
||||||
ipcRenderer.send("renderer:loaded");
|
ipcRenderer.send(IpcRendererNavigationEvents.LOADED);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
@ -9,6 +9,7 @@ export const enum IpcRendererNavigationEvents {
|
|||||||
CLUSTER_VIEW_CURRENT_ID = "renderer:cluster-id-of-active-view",
|
CLUSTER_VIEW_CURRENT_ID = "renderer:cluster-id-of-active-view",
|
||||||
NAVIGATE_IN_APP = "renderer:navigate",
|
NAVIGATE_IN_APP = "renderer:navigate",
|
||||||
NAVIGATE_IN_CLUSTER = "renderer:navigate-in-cluster",
|
NAVIGATE_IN_CLUSTER = "renderer:navigate-in-cluster",
|
||||||
|
LOADED = "renderer:loaded",
|
||||||
}
|
}
|
||||||
|
|
||||||
export function bindEvents() {
|
export function bindEvents() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user