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:
parent
f297407156
commit
74abf474d7
@ -45,6 +45,8 @@ import { HotbarIcon } from "../hotbar/hotbar-icon";
|
|||||||
import { makeObservable, observable } from "mobx";
|
import { makeObservable, observable } from "mobx";
|
||||||
import type { CatalogEntityContextMenuContext } from "../../../common/catalog";
|
import type { CatalogEntityContextMenuContext } from "../../../common/catalog";
|
||||||
import { HotbarStore } from "../../../common/hotbar-store";
|
import { HotbarStore } from "../../../common/hotbar-store";
|
||||||
|
import { broadcastMessage } from "../../../common/ipc";
|
||||||
|
import { IpcRendererNavigationEvents } from "../../navigation/events";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
className?: string;
|
className?: string;
|
||||||
@ -55,7 +57,13 @@ export class Sidebar extends React.Component<Props> {
|
|||||||
static displayName = "Sidebar";
|
static displayName = "Sidebar";
|
||||||
@observable private contextMenu: CatalogEntityContextMenuContext = {
|
@observable private contextMenu: CatalogEntityContextMenuContext = {
|
||||||
menuItems: [],
|
menuItems: [],
|
||||||
navigate,
|
navigate: (url: string, forceMainFrame = true) => {
|
||||||
|
if (forceMainFrame) {
|
||||||
|
broadcastMessage(IpcRendererNavigationEvents.NAVIGATE_IN_APP, url);
|
||||||
|
} else {
|
||||||
|
navigate(url);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(props: Props) {
|
constructor(props: Props) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user