Skip to content

Commit

Permalink
Fix ability to update address of existing hosts via Add PC dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
cgutman committed Sep 3, 2017
1 parent 498bff4 commit 584d504
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions static/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,19 @@ function addHost() {
var _nvhttpHost = new NvHTTP(inputHost, myUniqueid, inputHost);

pairTo(_nvhttpHost, function() {
// Check if we already have record of this host
if (hosts[_nvhttpHost.serverUid] != null) {
// Just update the addresses
hosts[_nvhttpHost.serverUid].address = _nvhttpHost.address;
hosts[_nvhttpHost.serverUid].userEnteredAddress = _nvhttpHost.userEnteredAddress;
}
else {
beginBackgroundPollingOfHost(_nvhttpHost);
addHostToGrid(_nvhttpHost);
saveHosts();
}, function() {
snackbarLog('pairing to ' + inputHost + ' failed!');
}
saveHosts();
}, function() {
snackbarLog('pairing to ' + inputHost + ' failed!');
});
modal.close();
});
Expand Down

0 comments on commit 584d504

Please sign in to comment.