From f51514d0e73937a3759af535af26851da2a8907d Mon Sep 17 00:00:00 2001 From: BAHADIR YILMAZ Date: Wed, 7 Nov 2018 11:44:52 +0300 Subject: [PATCH] gui: Select / Deselect all folders / devices (#fixes 4000) (#5307) --- .../syncthing/core/syncthingController.js | 28 +++++++++++++++++++ .../syncthing/device/editDeviceModalView.html | 6 +++- .../syncthing/folder/editFolderModalView.html | 6 +++- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js index 445dd3b69..1d4037d8a 100755 --- a/gui/default/syncthing/core/syncthingController.js +++ b/gui/default/syncthing/core/syncthingController.js @@ -1371,6 +1371,20 @@ angular.module('syncthing.core') $('#editDevice').modal(); }; + $scope.selectAllFolders = function() { + Object.entries($scope.folders).forEach(entry =>{ + let id = entry[1].id; + $scope.currentDevice.selectedFolders[id] = true; + }); + }; + + $scope.deSelectAllFolders = function() { + Object.entries($scope.folders).forEach(entry =>{ + let id = entry[1].id; + $scope.currentDevice.selectedFolders[id] = false; + }); + }; + $scope.addDevice = function (deviceID, name) { return $http.get(urlbase + '/system/discovery') .success(function (registry) { @@ -1694,6 +1708,20 @@ angular.module('syncthing.core') $scope.editFolderModal(); }; + $scope.selectAllDevices = function() { + var devices = $scope.otherDevices(); + for (var i = 0; i < devices.length; i++){ + $scope.currentFolder.selectedDevices[devices[i].deviceID] = true; + } + }; + + $scope.deSelectAllDevices = function() { + var devices = $scope.otherDevices(); + for (var i = 0; i < devices.length; i++){ + $scope.currentFolder.selectedDevices[devices[i].deviceID] = false; + } + }; + $scope.addFolder = function () { $http.get(urlbase + '/svc/random/string?length=10').success(function (data) { $scope.editingExisting = false; diff --git a/gui/default/syncthing/device/editDeviceModalView.html b/gui/default/syncthing/device/editDeviceModalView.html index 6a0bb69ab..c51d3c8e0 100644 --- a/gui/default/syncthing/device/editDeviceModalView.html +++ b/gui/default/syncthing/device/editDeviceModalView.html @@ -67,7 +67,11 @@
-

Select the folders to share with this device.

+

+ Select the folders to share with this device.  + Select All  + Deselect All +

diff --git a/gui/default/syncthing/folder/editFolderModalView.html b/gui/default/syncthing/folder/editFolderModalView.html index 0b03583cc..4016269a9 100644 --- a/gui/default/syncthing/folder/editFolderModalView.html +++ b/gui/default/syncthing/folder/editFolderModalView.html @@ -42,7 +42,11 @@
-

Select the devices to share this folder with.

+

+ Select the devices to share this folder with.  + Select All  + Deselect All +