GUI: Added "Pause All Folders" and "Resume All Folders buttons

As per scienmind's post (#3964) i though it was a good idea and wanted
such a button.

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3973
LGTM: AudriusButkevicius, calmh
This commit is contained in:
Niller303 2017-02-09 20:31:23 +00:00 committed by Jakob Borg
parent 22903df2c1
commit 0c68e1e510
2 changed files with 29 additions and 0 deletions

View File

@ -437,6 +437,12 @@
</div>
</div>
<span class="pull-right">
<button type="button" class="btn btn-sm btn-default" ng-click="setAllFoldersPause(true)" ng-if="isAtleastOneFolderPausedStateSetTo(false)">
<span class="fa fa-refresh"></span>&nbsp;<span translate>Pause All Folders</span>
</button>
<button type="button" class="btn btn-sm btn-default" ng-click="setAllFoldersPause(false)" ng-if="isAtleastOneFolderPausedStateSetTo(true)">
<span class="fa fa-refresh"></span>&nbsp;<span translate>Resume All Folders</span>
</button>
<button type="button" class="btn btn-sm btn-default" ng-click="rescanAllFolders()">
<span class="fa fa-refresh"></span>&nbsp;<span translate>Rescan All</span>
</button>

View File

@ -1661,6 +1661,29 @@ angular.module('syncthing.core')
$http.post(urlbase + "/db/scan?folder=" + encodeURIComponent(folder));
};
$scope.setAllFoldersPause = function(pause) {
var folderListCache = $scope.folderList();
for (var i = 0; i < folderListCache.length; i++) {
folderListCache[i].paused = pause;
}
$scope.config.folders = folderList(folderListCache);
$scope.saveConfig();
};
$scope.isAtleastOneFolderPausedStateSetTo = function(pause) {
var folderListCache = $scope.folderList();
for (var i = 0; i < folderListCache.length; i++) {
if (folderListCache[i].paused == pause) {
return true;
}
}
return false;
};
$scope.bumpFile = function (folder, file) {
var url = urlbase + "/db/prio?folder=" + encodeURIComponent(folder) + "&file=" + encodeURIComponent(file);
// In order to get the right view of data in the response.