1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Navigate cluster context menus via broadcastMessage (#4139)

* Navigate cluster context menus via broadcastMessage

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Ability to navigate context in different frames

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Renaming an argument

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2021-10-28 06:50:15 +03:00 committed by GitHub
parent f297407156
commit 74abf474d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,6 +45,8 @@ import { HotbarIcon } from "../hotbar/hotbar-icon";
import { makeObservable, observable } from "mobx";
import type { CatalogEntityContextMenuContext } from "../../../common/catalog";
import { HotbarStore } from "../../../common/hotbar-store";
import { broadcastMessage } from "../../../common/ipc";
import { IpcRendererNavigationEvents } from "../../navigation/events";
interface Props {
className?: string;
@ -55,7 +57,13 @@ export class Sidebar extends React.Component<Props> {
static displayName = "Sidebar";
@observable private contextMenu: CatalogEntityContextMenuContext = {
menuItems: [],
navigate,
navigate: (url: string, forceMainFrame = true) => {
if (forceMainFrame) {
broadcastMessage(IpcRendererNavigationEvents.NAVIGATE_IN_APP, url);
} else {
navigate(url);
}
}
};
constructor(props: Props) {