make sure button disabling is consistent on refresh

This commit is contained in:
Stephen Birarda 2015-12-21 15:04:30 -07:00
parent cf4b6cb2cf
commit 807fb2bee1
2 changed files with 10 additions and 11 deletions

View file

@ -35,22 +35,20 @@ $(function() {
return;
}
if (sendingProcess.name == "domain-server") {
toggleManageButton(settingsButton,
sendingProcess.state == HFProcess.ProcessStates.STARTED);
}
switch (sendingProcess.state) {
case HFProcess.ProcessStates.STOPPED:
processCircle.attr('class', 'circle stopped');
break;
case HFProcess.ProcessStates.STOPPING:
if (sendingProcess.name == "domain-server") {
console.log("STOPPING DS");
toggleManageButton(settingsButton, false);
}
processCircle.attr('class', 'circle stopping');
break;
case HFProcess.ProcessStates.STARTED:
if (sendingProcess.name == "domain-server") {
toggleManageButton(settingsButton, true);
}
processCircle.attr('class', 'circle started');
break;
@ -63,7 +61,6 @@ $(function() {
switch (sendingGroup.state) {
case HFProcess.ProcessGroupStates.STOPPED:
break;
case HFProcess.ProcessGroupStates.STOPPING:
// if the process group is stopping, the stop button should be disabled
toggleManageButton(stopButton, false);

View file

@ -136,9 +136,9 @@ app.on('ready', function() {
}
};
function sendProcessGroupUpdate(process) {
function sendProcessGroupUpdate(processGroup) {
if (mainWindow) {
mainWindow.webContents.send('process-group-update', process);
mainWindow.webContents.send('process-group-update', processGroup);
}
}
@ -175,6 +175,8 @@ app.on('ready', function() {
for (let process of homeServer.processes) {
sendProcessUpdate(process);
}
sendProcessGroupUpdate(homeServer);
});
}
});