diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js index ff4143fca..bc045e56f 100755 --- a/gui/default/syncthing/core/syncthingController.js +++ b/gui/default/syncthing/core/syncthingController.js @@ -1614,6 +1614,11 @@ angular.module('syncthing.core') return $scope.currentDevice._editing == 'existing'; } + $scope.editingDeviceNew = function() { + // The "new-pending" value is intentionally disregarded here. + return $scope.currentDevice._editing == 'new'; + } + $scope.editDeviceExisting = function (deviceCfg) { $scope.currentDevice = $.extend({}, deviceCfg); $scope.currentDevice._editing = "existing"; @@ -1683,7 +1688,11 @@ angular.module('syncthing.core') $scope.currentDevice = p.data; $scope.currentDevice.name = name; $scope.currentDevice.deviceID = deviceID; - $scope.currentDevice._editing = "add"; + if (deviceID) { + $scope.currentDevice._editing = "new-pending"; + } else { + $scope.currentDevice._editing = "new"; + } initShareEditing('device'); $scope.currentSharing.unrelated = $scope.folderList(); editDeviceModal(); diff --git a/gui/default/syncthing/core/validDeviceidDirective.js b/gui/default/syncthing/core/validDeviceidDirective.js index 8c0456488..0a84ffe06 100644 --- a/gui/default/syncthing/core/validDeviceidDirective.js +++ b/gui/default/syncthing/core/validDeviceidDirective.js @@ -4,23 +4,18 @@ angular.module('syncthing.core') require: 'ngModel', link: function (scope, elm, attrs, ctrl) { ctrl.$parsers.unshift(function (viewValue) { - if (scope.currentDevice._editing != "add") { - // we shouldn't validate - ctrl.$setValidity('validDeviceid', true); - } else { - $http.get(urlbase + '/svc/deviceid?id=' + viewValue).success(function (resp) { - if (resp.error) { - ctrl.$setValidity('validDeviceid', false); - } else { - ctrl.$setValidity('validDeviceid', true); - } - }); - //Prevents user from adding a duplicate ID - if (scope.devices.hasOwnProperty(viewValue)) { - ctrl.$setValidity('unique', false); + $http.get(urlbase + '/svc/deviceid?id=' + viewValue).success(function (resp) { + if (resp.error) { + ctrl.$setValidity('validDeviceid', false); } else { - ctrl.$setValidity('unique', true); + ctrl.$setValidity('validDeviceid', true); } + }); + //Prevents user from adding a duplicate ID + if (scope.devices.hasOwnProperty(viewValue)) { + ctrl.$setValidity('unique', false); + } else { + ctrl.$setValidity('unique', true); } return viewValue; }); diff --git a/gui/default/syncthing/device/editDeviceModalView.html b/gui/default/syncthing/device/editDeviceModalView.html index 6ae453821..4a0cb9da6 100644 --- a/gui/default/syncthing/device/editDeviceModalView.html +++ b/gui/default/syncthing/device/editDeviceModalView.html @@ -10,19 +10,20 @@
-
-
- -
- -
+
+ +
{{currentDevice.deviceID}}
+
+
+
+
-

+

You can also select one of these nearby devices:
  • @@ -31,7 +32,7 @@
-

+

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. @@ -40,14 +41,6 @@ A device with that ID is already added.

-
-
{{currentDevice.deviceID}}
-
- -
-
@@ -172,7 +165,7 @@ -
+