|
|
@@ -15,6 +15,15 @@ angular.module('syncthing.core')
|
|
|
ctrl.$setValidity('validDeviceid', true);
|
|
|
}
|
|
|
});
|
|
|
+ //Prevents user from adding a duplicate ID
|
|
|
+ var matches = scope.devices.filter(function (n) {
|
|
|
+ return n.deviceID == viewValue;
|
|
|
+ }).length;
|
|
|
+ if (matches > 0) {
|
|
|
+ ctrl.$setValidity('unique', false);
|
|
|
+ } else {
|
|
|
+ ctrl.$setValidity('unique', true);
|
|
|
+ }
|
|
|
}
|
|
|
return viewValue;
|
|
|
});
|