From 8d13e01342bf74c1006c7527c16e088f7a66d0c1 Mon Sep 17 00:00:00 2001 From: Simon Frei Date: Thu, 29 Jun 2017 13:47:42 +0000 Subject: [PATCH] gui: Fix discovered devices list (follow-up to #4186) GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4239 --- .../syncthing/core/syncthingController.js | 8 +++-- .../syncthing/device/editDeviceModalView.html | 36 ++++++++++--------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js index d57989c52..163277f2c 100755 --- a/gui/default/syncthing/core/syncthingController.js +++ b/gui/default/syncthing/core/syncthingController.js @@ -1186,13 +1186,17 @@ angular.module('syncthing.core') return $http.get(urlbase + '/system/discovery') .success(function (registry) { $scope.discovery = []; + outer: for (var id in registry) { if ($scope.discovery.length === 5) { break; } - if (!(id in $scope.devices)) { - $scope.discovery.push(id); + for (var i = 0; i < $scope.devices.length; i++) { + if ($scope.devices[i].deviceID === id) { + continue outer; + } } + $scope.discovery.push(id); } }) .then(function () { diff --git a/gui/default/syncthing/device/editDeviceModalView.html b/gui/default/syncthing/device/editDeviceModalView.html index 1f4c068cd..55737c70d 100644 --- a/gui/default/syncthing/device/editDeviceModalView.html +++ b/gui/default/syncthing/device/editDeviceModalView.html @@ -3,24 +3,26 @@
- - - +
+ + + +

+ You can also select one of these nearby devices: +

+

+

+ The device ID to enter here can be found in the "Actions > Show ID" dialog on the other device. Spaces and dashes are optional (ignored). + When adding a new device, keep in mind that this device must be added on the other side too. + The device ID cannot be blank. + The entered device ID does not look valid. It should be a 52 or 56 character string consisting of letters and numbers, with spaces and dashes being optional. + A device with that ID is already added. +

+
{{currentDevice.deviceID}}
-

- You can also select one of these nearby devices: -

-

-

- The device ID to enter here can be found in the "Actions > Show ID" dialog on the other device. Spaces and dashes are optional (ignored). - When adding a new device, keep in mind that this device must be added on the other side too. - The device ID cannot be blank. - The entered device ID does not look valid. It should be a 52 or 56 character string consisting of letters and numbers, with spaces and dashes being optional. - A device with that ID is already added. -