mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 23:16:20 +02:00
per process state in home server group
This commit is contained in:
parent
b70dde27df
commit
2b31332de0
4 changed files with 48 additions and 30 deletions
|
@ -54,11 +54,11 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="ds-status" class="process-status">
|
<div id="ds-status" class="process-status">
|
||||||
<div class="circle started"></div>
|
<div class="circle stopped"></div>
|
||||||
<span>Domain Server</span>
|
<span>Domain Server</span>
|
||||||
</div>
|
</div>
|
||||||
<div id="ac-status" class="process-status">
|
<div id="ac-status" class="process-status">
|
||||||
<div class="circle started"></div>
|
<div class="circle stopped"></div>
|
||||||
<span>Assignment Clients</span>
|
<span>Assignment Clients</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,18 +11,27 @@ $(function() {
|
||||||
// $('#process-interface .power-on').prop('disabled', interfaceOn);
|
// $('#process-interface .power-on').prop('disabled', interfaceOn);
|
||||||
// $('#process-interface .power-off').prop('disabled', !interfaceOn);
|
// $('#process-interface .power-off').prop('disabled', !interfaceOn);
|
||||||
|
|
||||||
var serverState = arg.home.state;
|
var sendingProcess = arg;
|
||||||
var serverCircles = $('#ds-status .circle, #ac-status .circle');
|
var processState = sendingProcess.state;
|
||||||
|
|
||||||
switch (serverState) {
|
var processCircle = null;
|
||||||
|
if (sendingProcess.name == "domain-server") {
|
||||||
|
processCircle = $('#ds-status .circle');
|
||||||
|
} else if (sendingProcess.name == "ac-monitor") {
|
||||||
|
processCircle = $('#ac-status .circle');
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (processState) {
|
||||||
case HFProcess.ProcessStates.STOPPED:
|
case HFProcess.ProcessStates.STOPPED:
|
||||||
serverCircles.attr('class', 'circle stopped');
|
processCircle.attr('class', 'circle stopped');
|
||||||
break;
|
break;
|
||||||
case HFProcess.ProcessStates.STOPPING:
|
case HFProcess.ProcessStates.STOPPING:
|
||||||
serverCircles.attr('class', 'circle stopping');
|
processCircle.attr('class', 'circle stopping');
|
||||||
break;
|
break;
|
||||||
case HFProcess.ProcessStates.STARTED:
|
case HFProcess.ProcessStates.STARTED:
|
||||||
serverCircles.attr('class', 'circle started');
|
processCircle.attr('class', 'circle started');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,5 +54,5 @@ $(function() {
|
||||||
|
|
||||||
ipcRenderer.on('process-update', onProcessUpdate);
|
ipcRenderer.on('process-update', onProcessUpdate);
|
||||||
|
|
||||||
ipcRenderer.send('update');
|
ipcRenderer.send('update-all-processes');
|
||||||
});
|
});
|
||||||
|
|
|
@ -114,10 +114,9 @@ app.on('ready', function() {
|
||||||
var pInterface = new Process('interface', interfacePath);
|
var pInterface = new Process('interface', interfacePath);
|
||||||
|
|
||||||
var homeServer = new ProcessGroup('home', [
|
var homeServer = new ProcessGroup('home', [
|
||||||
new Process('domain_server', dsPath),
|
new Process('domain-server', dsPath),
|
||||||
new Process('ac_monitor', acPath, ['-n6', '--log-directory', logPath])
|
new Process('ac-monitor', acPath, ['-n6', '--log-directory', logPath])
|
||||||
]);
|
]);
|
||||||
homeServer.start();
|
|
||||||
|
|
||||||
// make sure we stop child processes on app quit
|
// make sure we stop child processes on app quit
|
||||||
app.on('quit', function(){
|
app.on('quit', function(){
|
||||||
|
@ -130,37 +129,45 @@ app.on('ready', function() {
|
||||||
home: homeServer
|
home: homeServer
|
||||||
};
|
};
|
||||||
|
|
||||||
function sendProcessUpdate() {
|
function sendProcessUpdate(process) {
|
||||||
if (mainWindow) {
|
if (mainWindow) {
|
||||||
console.log("Sending process update to web view");
|
console.log("Sending process update to web view for " + process.name);
|
||||||
mainWindow.webContents.send('process-update', processes);
|
mainWindow.webContents.send('process-update', process);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
pInterface.on('state-update', sendProcessUpdate);
|
// handle process updates
|
||||||
|
// pInterface.on('state-update', sendProcessUpdate);
|
||||||
homeServer.on('state-update', sendProcessUpdate);
|
homeServer.on('state-update', sendProcessUpdate);
|
||||||
|
|
||||||
ipcMain.on('start-process', function(event, arg) {
|
// start the home server
|
||||||
pInterface.start();
|
homeServer.start();
|
||||||
sendProcessUpdate();
|
|
||||||
});
|
// ipcMain.on('start-process', function(event, arg) {
|
||||||
ipcMain.on('stop-process', function(event, arg) {
|
// pInterface.start();
|
||||||
pInterface.stop();
|
// });
|
||||||
sendProcessUpdate();
|
// ipcMain.on('stop-process', function(event, arg) {
|
||||||
});
|
// pInterface.stop();
|
||||||
|
// });
|
||||||
|
|
||||||
ipcMain.on('restart-server', function(event, arg) {
|
ipcMain.on('restart-server', function(event, arg) {
|
||||||
homeServer.restart();
|
homeServer.restart();
|
||||||
sendProcessUpdate();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('stop-server', function(event, arg) {
|
ipcMain.on('stop-server', function(event, arg) {
|
||||||
homeServer.stop();
|
homeServer.stop();
|
||||||
sendProcessUpdate();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('open-logs', function(event, arg) {
|
ipcMain.on('open-logs', function(event, arg) {
|
||||||
openFileBrowser(logPath);
|
openFileBrowser(logPath);
|
||||||
});
|
});
|
||||||
ipcMain.on('update', sendProcessUpdate);
|
|
||||||
|
|
||||||
sendProcessUpdate();
|
ipcMain.on('update-all-processes', function(event, arg) {
|
||||||
|
// enumerate our processes and call sendProcessUpdate to update
|
||||||
|
// the window with their status
|
||||||
|
for (let process of homeServer.processes) {
|
||||||
|
sendProcessUpdate(process);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -89,7 +89,7 @@ ProcessGroup.prototype = extend(ProcessGroup.prototype, {
|
||||||
this.restarting = false;
|
this.restarting = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.emit('state-update', this, process);
|
this.emit('state-update', process);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -196,6 +196,8 @@ Process.prototype = extend(Process.prototype, {
|
||||||
}
|
}
|
||||||
this.child.kill();
|
this.child.kill();
|
||||||
this.state = ProcessStates.STOPPING;
|
this.state = ProcessStates.STOPPING;
|
||||||
|
|
||||||
|
this.emit('state-update', this);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
|
|
Loading…
Reference in a new issue