Edit device after accepting new connection (fixes #1929)

This will open the "edit device" dialogue after accepting a new device
connection. This will allow the user to specify the name of the device
or leave it blank in case they want to accept whatever the device
advertises once it connects.
This commit is contained in:
Anderson Mesquita 2015-12-18 15:33:11 -05:00
parent ba01433381
commit 8120535a35
3 changed files with 9 additions and 19 deletions

View File

@ -135,8 +135,8 @@
</div>
<div class="panel-footer clearfix">
<div class="pull-right">
<button type="button" class="btn btn-sm btn-success" ng-click="addNewDeviceID(device)">
<span class="fa fa-check"></span>&nbsp;<span translate>Add</span>
<button type="button" class="btn btn-sm btn-success" ng-click="addDevice(device)">
<span class="fa fa-plus"></span>&nbsp;<span translate>Add Device</span>
</button>
<button type="button" class="btn btn-sm btn-danger" ng-click="ignoreRejectedDevice(device)">
<span class="fa fa-times"></span>&nbsp;<span translate>Ignore</span>

View File

@ -970,13 +970,14 @@ angular.module('syncthing.core')
$('#idqr').modal('show');
};
$scope.addDevice = function () {
$http.get(urlbase + '/system/discovery')
$scope.addDevice = function (deviceID) {
return $http.get(urlbase + '/system/discovery')
.success(function (registry) {
$scope.discovery = registry;
})
.then(function () {
$scope.currentDevice = {
deviceID: deviceID,
_addressesStr: 'dynamic',
compression: 'metadata',
introducer: false,
@ -1016,18 +1017,7 @@ angular.module('syncthing.core')
$scope.saveDevice = function () {
$('#editDevice').modal('hide');
$scope.saveDeviceConfig($scope.currentDevice);
};
$scope.addNewDeviceID = function (device) {
var deviceCfg = {
deviceID: device,
_addressesStr: 'dynamic',
compression: 'metadata',
introducer: false,
selectedFolders: {}
};
$scope.saveDeviceConfig(deviceCfg);
$scope.dismissDeviceRejection(device);
$scope.dismissDeviceRejection($scope.currentDevice.deviceID);
};
$scope.saveDeviceConfig = function (deviceCfg) {

File diff suppressed because one or more lines are too long