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

View file

@ -136,9 +136,9 @@ app.on('ready', function() {
} }
}; };
function sendProcessGroupUpdate(process) { function sendProcessGroupUpdate(processGroup) {
if (mainWindow) { 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) { for (let process of homeServer.processes) {
sendProcessUpdate(process); sendProcessUpdate(process);
} }
sendProcessGroupUpdate(homeServer);
}); });
} }
}); });