mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-31 18:18:02 +01:00
send initial local server status
This commit is contained in:
parent
4078cb1f1e
commit
ebb196f164
@ -245,6 +245,11 @@ electron.ipcMain.on("get-id", (event) => {
|
||||
return;
|
||||
});
|
||||
|
||||
electron.ipcMain.on("local-server-status", (event) => {
|
||||
event.returnValue = (localServerProc != null);
|
||||
return;
|
||||
});
|
||||
|
||||
electron.ipcMain.on("restart-server", (event) => {
|
||||
if (localServerProc != null) {
|
||||
localServerProc.kill();
|
||||
|
@ -2587,7 +2587,7 @@ class Main extends React.Component<{}, {}> {
|
||||
<MainSideBar/>
|
||||
<SessionView/>
|
||||
</div>
|
||||
<If condition={!GlobalModel.ws.open.get()}>
|
||||
<If condition={!GlobalModel.ws.open.get() || !GlobalModel.localServerRunning.get()}>
|
||||
<DisconnectedModal/>
|
||||
</If>
|
||||
</div>
|
||||
|
@ -1529,13 +1529,15 @@ class Model {
|
||||
termUsedRowsCache : Record<string, number> = {};
|
||||
debugCmds : number = 0;
|
||||
debugSW : OV<boolean> = mobx.observable.box(false);
|
||||
localServerRunning : OV<boolean> = mobx.observable.box(false);
|
||||
localServerRunning : OV<boolean>;
|
||||
|
||||
constructor() {
|
||||
this.clientId = getApi().getId();
|
||||
this.ws = new WSControl(this.clientId, (message : any) => this.runUpdate(message, false));
|
||||
this.ws.reconnect();
|
||||
this.inputModel = new InputModel();
|
||||
let isLocalServerRunning = getApi().getLocalServerStatus();
|
||||
this.localServerRunning = mobx.observable.box(isLocalServerRunning);
|
||||
getApi().onTCmd(this.onTCmd.bind(this));
|
||||
getApi().onICmd(this.onICmd.bind(this));
|
||||
getApi().onLCmd(this.onLCmd.bind(this));
|
||||
|
@ -2,6 +2,7 @@ let {contextBridge, ipcRenderer} = require("electron");
|
||||
|
||||
contextBridge.exposeInMainWorld("api", {
|
||||
getId: () => ipcRenderer.sendSync("get-id"),
|
||||
getLocalServerStatus: () => ipcRenderer.sendSync("local-server-status"),
|
||||
restartLocalServer: () => ipcRenderer.sendSync("restart-server"),
|
||||
onTCmd: (callback) => ipcRenderer.on("t-cmd", callback),
|
||||
onICmd: (callback) => ipcRenderer.on("i-cmd", callback),
|
||||
|
Loading…
Reference in New Issue
Block a user