Disallow adding duplicate device ID in GUI

Adds check in valid device id to check for uniqueness
This commit is contained in:
Kevin Allen
2015-12-29 22:42:19 -05:00
committed by Jakob Borg
parent 7b3fa8da60
commit 4a6f1718b8
2 changed files with 10 additions and 0 deletions

View File

@@ -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;
});