lib/model, gui: Allow creating and editing ignores of paused folders (fixes #3608)
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3996 LGTM: calmh, AudriusButkevicius
This commit is contained in:
committed by
Audrius Butkevicius
parent
c5e0c47989
commit
25b314f5f1
@@ -58,6 +58,24 @@ angular.module('syncthing.core')
|
||||
$scope.metricRates = (window.localStorage["metricRates"] == "true");
|
||||
} catch (exception) { }
|
||||
|
||||
$scope.folderDefaults = {
|
||||
selectedDevices: {},
|
||||
type: "readwrite",
|
||||
rescanIntervalS: 60,
|
||||
minDiskFreePct: 1,
|
||||
maxConflicts: 10,
|
||||
fsync: true,
|
||||
order: "random",
|
||||
fileVersioningSelector: "none",
|
||||
trashcanClean: 0,
|
||||
simpleKeep: 5,
|
||||
staggeredMaxAge: 365,
|
||||
staggeredCleanInterval: 3600,
|
||||
staggeredVersionsPath: "",
|
||||
externalCommand: "",
|
||||
autoNormalize: true
|
||||
};
|
||||
|
||||
$scope.localStateTotal = {
|
||||
bytes: 0,
|
||||
files: 0
|
||||
@@ -1393,24 +1411,9 @@ angular.module('syncthing.core')
|
||||
};
|
||||
|
||||
$scope.addFolder = function () {
|
||||
$scope.currentFolder = {
|
||||
selectedDevices: {},
|
||||
type: "readwrite",
|
||||
rescanIntervalS: 60,
|
||||
minDiskFreePct: 1,
|
||||
maxConflicts: 10,
|
||||
fsync: true,
|
||||
order: "random",
|
||||
fileVersioningSelector: "none",
|
||||
trashcanClean: 0,
|
||||
simpleKeep: 5,
|
||||
staggeredMaxAge: 365,
|
||||
staggeredCleanInterval: 3600,
|
||||
staggeredVersionsPath: "",
|
||||
externalCommand: "",
|
||||
autoNormalize: true
|
||||
};
|
||||
$scope.currentFolder = angular.copy($scope.folderDefaults);
|
||||
$scope.editingExisting = false;
|
||||
$('#editIgnores textarea').val("");
|
||||
$scope.folderEditor.$setPristine();
|
||||
$http.get(urlbase + '/svc/random/string?length=10').success(function (data) {
|
||||
$scope.currentFolder.id = (data.random.substr(0, 5) + '-' + data.random.substr(5, 5)).toLowerCase();
|
||||
@@ -1420,26 +1423,11 @@ angular.module('syncthing.core')
|
||||
|
||||
$scope.addFolderAndShare = function (folder, folderLabel, device) {
|
||||
$scope.dismissFolderRejection(folder, device);
|
||||
$scope.currentFolder = {
|
||||
id: folder,
|
||||
label: folderLabel,
|
||||
selectedDevices: {},
|
||||
rescanIntervalS: 60,
|
||||
minDiskFreePct: 1,
|
||||
maxConflicts: 10,
|
||||
fsync: true,
|
||||
order: "random",
|
||||
fileVersioningSelector: "none",
|
||||
trashcanClean: 0,
|
||||
simpleKeep: 5,
|
||||
staggeredMaxAge: 365,
|
||||
staggeredCleanInterval: 3600,
|
||||
staggeredVersionsPath: "",
|
||||
externalCommand: "",
|
||||
autoNormalize: true,
|
||||
viewFlags: {
|
||||
importFromOtherDevice: true
|
||||
}
|
||||
$scope.currentFolder = angular.copy($scope.folderDefaults);
|
||||
$scope.currentFolder.id = folder;
|
||||
$scope.currentFolder.label = folderLabel;
|
||||
$scope.currentFolder.viewFlags = {
|
||||
importFromOtherDevice: true
|
||||
};
|
||||
$scope.currentFolder.selectedDevices[device] = true;
|
||||
|
||||
@@ -1516,10 +1504,20 @@ angular.module('syncthing.core')
|
||||
delete folderCfg.versioning;
|
||||
}
|
||||
|
||||
var ignores = $('#editIgnores textarea').val().trim();
|
||||
if (!$scope.editingExisting && ignores) {
|
||||
folderCfg.paused = true;
|
||||
};
|
||||
|
||||
$scope.folders[folderCfg.id] = folderCfg;
|
||||
$scope.config.folders = folderList($scope.folders);
|
||||
|
||||
$scope.saveConfig();
|
||||
|
||||
if (!$scope.editingExisting && ignores) {
|
||||
$scope.saveIgnores();
|
||||
$scope.setFolderPause(folderCfg.id, false);
|
||||
};
|
||||
};
|
||||
|
||||
$scope.dismissFolderRejection = function (folder, device) {
|
||||
@@ -1593,11 +1591,21 @@ angular.module('syncthing.core')
|
||||
});
|
||||
};
|
||||
|
||||
$scope.saveIgnores = function () {
|
||||
if (!$scope.editingExisting) {
|
||||
$scope.editIgnoresOnAddingFolder = function () {
|
||||
if ($scope.editingExisting) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($scope.currentFolder.path.endsWith($scope.system.pathSeparator)) {
|
||||
$scope.currentFolder.path = $scope.currentFolder.path.slice(0, -1);
|
||||
};
|
||||
$('#editIgnores').modal().one('shown.bs.modal', function () {
|
||||
textArea.focus();
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
$scope.saveIgnores = function () {
|
||||
$http.post(urlbase + '/db/ignores?folder=' + encodeURIComponent($scope.currentFolder.id), {
|
||||
ignore: $('#editIgnores textarea').val().split('\n')
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user