From 584d504273ced0116e70b452293dfca019b76ee8 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 2 Sep 2017 21:26:28 -0700 Subject: [PATCH] Fix ability to update address of existing hosts via Add PC dialog --- static/js/index.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/static/js/index.js b/static/js/index.js index c3f44ba..2631d9f 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -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(); });