From 807fb2bee1073855d4f85dc018733ab44d41f5ad Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 21 Dec 2015 15:04:30 -0700 Subject: [PATCH] make sure button disabling is consistent on refresh --- console/src/index.js | 15 ++++++--------- console/src/main.js | 6 ++++-- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/console/src/index.js b/console/src/index.js index 032ed8eb06..2f45f39320 100755 --- a/console/src/index.js +++ b/console/src/index.js @@ -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); diff --git a/console/src/main.js b/console/src/main.js index 7950a629e3..e87384f235 100644 --- a/console/src/main.js +++ b/console/src/main.js @@ -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); }); } });