gui: Add "Pause All"/"Resume All" button for devices (fixes #6530) (#6549)

This commit is contained in:
MikolajTwarog 2020-04-27 00:18:05 +02:00 committed by GitHub
parent d9664a946d
commit 5224f07ac8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 0 deletions

View File

@ -788,6 +788,12 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<span class="pull-right"> <span class="pull-right">
<button type="button" class="btn btn-sm btn-default" ng-click="setAllDevicesPause(true)" ng-if="isAtleastOneDevicePausedStateSetTo(false)">
<span class="fas fa-pause"></span>&nbsp;<span translate>Pause All</span>
</button>
<button type="button" class="btn btn-sm btn-default" ng-click="setAllDevicesPause(false)" ng-if="isAtleastOneDevicePausedStateSetTo(true)">
<span class="fas fa-play"></span>&nbsp;<span translate>Resume All</span>
</button>
<button type="button" class="btn btn-sm btn-default" ng-click="globalChanges()"> <button type="button" class="btn btn-sm btn-default" ng-click="globalChanges()">
<span class="fas fa-fw fa-info-circle"></span>&nbsp;<span translate>Recent Changes</span> <span class="fas fa-fw fa-info-circle"></span>&nbsp;<span translate>Recent Changes</span>
</button> </button>

View File

@ -1588,6 +1588,24 @@ angular.module('syncthing.core')
return devices; return devices;
}; };
$scope.setAllDevicesPause = function (pause) {
$scope.devices.forEach(function (cfg) {
cfg.paused = pause;
});
$scope.config.devices = $scope.devices;
$scope.saveConfig();
}
$scope.isAtleastOneDevicePausedStateSetTo = function (pause) {
for (var i = 0; i < $scope.devices.length; i++) {
if ($scope.devices[i].paused == pause) {
return true;
}
}
return false
}
$scope.errorList = function () { $scope.errorList = function () {
if (!$scope.errors) { if (!$scope.errors) {
return []; return [];