mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
disable settings button when ds not running
This commit is contained in:
parent
410d852d36
commit
cf4b6cb2cf
1 changed files with 24 additions and 4 deletions
|
@ -2,6 +2,19 @@ $(function() {
|
|||
const ipcRenderer = require('electron').ipcRenderer;
|
||||
const HFProcess = require('./modules/hf-process.js');
|
||||
|
||||
var settingsButton = $('#manage-server #settings');
|
||||
|
||||
function toggleManageButton(button, enabled) {
|
||||
console.log(button);
|
||||
if (enabled) {
|
||||
button.attr('href', '#');
|
||||
button.removeClass('disabled');
|
||||
} else {
|
||||
button.removeAttr('href');
|
||||
button.addClass('disabled');
|
||||
}
|
||||
}
|
||||
|
||||
function onProcessUpdate(event, arg) {
|
||||
console.log("update", event, arg);
|
||||
|
||||
|
@ -27,9 +40,18 @@ $(function() {
|
|||
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;
|
||||
}
|
||||
|
@ -44,13 +66,11 @@ $(function() {
|
|||
break;
|
||||
case HFProcess.ProcessGroupStates.STOPPING:
|
||||
// if the process group is stopping, the stop button should be disabled
|
||||
stopButton.removeAttr('href');
|
||||
stopButton.addClass('disabled');
|
||||
toggleManageButton(stopButton, false);
|
||||
break;
|
||||
case HFProcess.ProcessGroupStates.STARTED:
|
||||
// if the process group is going, the stop button should be active
|
||||
stopButton.attr('href', '#');
|
||||
stopButton.removeClass('disabled');
|
||||
toggleManageButton(stopButton, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue