Pārlūkot izejas kodu

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.
Anderson Mesquita 10 gadi atpakaļ
vecāks
revīzija
8120535a35
3 mainītis faili ar 7 papildinājumiem un 17 dzēšanām
  1. 2 2
      gui/index.html
  2. 4 14
      gui/syncthing/core/syncthingController.js
  3. 1 1
      lib/auto/gui.files.go

+ 2 - 2
gui/index.html

@@ -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>

+ 4 - 14
gui/syncthing/core/syncthingController.js

@@ -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) {

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
lib/auto/gui.files.go


Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels