mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Reload active dashboard view
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
505a5c7d9f
commit
0cda9c08fe
@ -13,6 +13,7 @@ export const clusterIpc = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|
||||||
activate: createIpcChannel({
|
activate: createIpcChannel({
|
||||||
channel: "cluster:activate",
|
channel: "cluster:activate",
|
||||||
handle: (clusterId: ClusterId) => {
|
handle: (clusterId: ClusterId) => {
|
||||||
|
|||||||
@ -155,14 +155,14 @@ export function buildMenu(windowManager: WindowManager) {
|
|||||||
label: 'Forward',
|
label: 'Forward',
|
||||||
accelerator: 'CmdOrCtrl+]',
|
accelerator: 'CmdOrCtrl+]',
|
||||||
click() {
|
click() {
|
||||||
webContents.getFocusedWebContents()?.goForward();
|
webContents.getFocusedWebContents()?.goForward()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Reload',
|
label: 'Reload',
|
||||||
accelerator: 'CmdOrCtrl+R',
|
accelerator: 'CmdOrCtrl+R',
|
||||||
click() {
|
click() {
|
||||||
webContents.getFocusedWebContents()?.reload();
|
windowManager.reload({ channel: "menu:reload" });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ role: 'toggleDevTools' },
|
{ role: 'toggleDevTools' },
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import type { ClusterId } from "../common/cluster-store";
|
import { ClusterId, clusterStore } from "../common/cluster-store";
|
||||||
import { BrowserWindow, dialog, ipcMain, shell, WebContents, webContents } from "electron"
|
import { BrowserWindow, dialog, ipcMain, shell, webContents } from "electron"
|
||||||
import windowStateKeeper from "electron-window-state"
|
import windowStateKeeper from "electron-window-state"
|
||||||
import { observable } from "mobx";
|
import { observable } from "mobx";
|
||||||
import { initMenu } from "./menu";
|
import { initMenu } from "./menu";
|
||||||
@ -58,6 +58,15 @@ export class WindowManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reload({ channel }: { channel: string }) {
|
||||||
|
const frameId = clusterStore.getById(this.activeClusterId)?.frameId;
|
||||||
|
if (frameId) {
|
||||||
|
this.mainView.webContents.sendToFrame(frameId, channel);
|
||||||
|
} else {
|
||||||
|
webContents.getFocusedWebContents()?.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async showMain() {
|
async showMain() {
|
||||||
try {
|
try {
|
||||||
await this.showSplash();
|
await this.showSplash();
|
||||||
|
|||||||
@ -33,8 +33,8 @@ export function getMatchedCluster() {
|
|||||||
return clusterStore.getById(getMatchedClusterId())
|
return clusterStore.getById(getMatchedClusterId())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Refresh global menu depending on active route's type (common/cluster view)
|
|
||||||
if (ipcRenderer) {
|
if (ipcRenderer) {
|
||||||
|
// Refresh global menu depending on active route's type (common/cluster view)
|
||||||
const isMainView = !getHostedClusterId();
|
const isMainView = !getHostedClusterId();
|
||||||
if (isMainView) {
|
if (isMainView) {
|
||||||
reaction(() => getMatchedClusterId(), clusterId => {
|
reaction(() => getMatchedClusterId(), clusterId => {
|
||||||
@ -43,4 +43,9 @@ if (ipcRenderer) {
|
|||||||
fireImmediately: true
|
fireImmediately: true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reload dashboard
|
||||||
|
ipcRenderer.on("menu:reload", () => {
|
||||||
|
location.reload();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user