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