Skip to content

Commit

Permalink
v0.5.1-alpha.10 (unlisted update): Fixed connectivity manager issue w…
Browse files Browse the repository at this point in the history
…here enabling API/P2P services for the first time would fail if services were already started via main config; added additional exception handlers for when services cannot be enabled.
  • Loading branch information
monicanagent committed Jun 29, 2019
1 parent 84eedbc commit f96b862
Showing 1 changed file with 22 additions and 15 deletions.
37 changes: 22 additions & 15 deletions src/web/scripts/libs/ConnectivityManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -538,31 +538,38 @@ class ConnectivityManager extends EventDispatcher {
requestObj.gateway = gatewayObj;
if (cbRef.checked == true) {
if (gatewayStarted == true) {
//gateway is already started, UI is probably mismatched
console.error ("Can't start \""+gatewayObj.configName+"\". Gateway is already started.");
serverSDBElement.innerHTML = restoreSDB;
ui.enable(listElement);
//gateway is already started (probably enabled at startup)
serverSDBElement.innerText = "[ Started ]";
this.populateServerSDB(gatewayObj);
ui.enable(listElement);
} else {
serverSDBElement.innerHTML = "[ Starting ]";
var result = await IPCSend("start-gateway", requestObj, true);
if (result.data == "ok") {
gatewayObj.started = true;
serverSDBElement.innerText = "[ Starting ]";
try {
var result = await IPCSend("start-gateway", requestObj, true);
if (result.data == "ok") {
gatewayObj.started = true;
serverSDBElement.innerText = "[ Started ]";
this.populateServerSDB(gatewayObj);
} else {
serverSDBElement.innerText = "[ Error Starting Services Connectivity ]";
}
} catch (err) {
serverSDBElement.innerText = "[ Error Starting Services Connectivity ]";
ui.enable(listElement);
}
serverSDBElement.innerHTML = "[ Started ]";
this.populateServerSDB(gatewayObj);
}
} else {
if (gatewayStarted == false) {
//gateway isn't started, UI is probably mismatched
console.error ("Can't stop \""+gatewayObj.configName+"\". Gateway isn't started.");
serverSDBElement.innerHTML = restoreSDB;
serverSDBElement.innerText = restoreSDB;
ui.enable(listElement);
} else {
serverSDBElement.innerHTML = "[ Stopping ]";
result = await IPCSend("stop-gateway", gatewayObj, true);
serverSDBElement.innerText = "[ Stopping ]";
var result = await IPCSend("stop-gateway", gatewayObj, true);
if (result.data == "ok") {
gatewayObj.started = false;
serverSDBElement.innerHTML = "[ Stopped ]";
serverSDBElement.innerText = "[ Stopped ]";
ui.enable(listElement);
ui.enable(cbRef);
}
Expand Down Expand Up @@ -607,7 +614,7 @@ class ConnectivityManager extends EventDispatcher {
}
}
var serverSDBElement = manageElement.querySelector(this.selectors.serverSDB);
serverSDBElement.innerHTML = sdbString;
serverSDBElement.innerText = sdbString;
return (true);
}

Expand Down

0 comments on commit f96b862

Please sign in to comment.