gui: Allow setting custom path for all versioning except external (#7377)

This commit is contained in:
tomasz1986 2021-02-20 01:48:46 +09:00 committed by Jakob Borg
parent 9be6f1a70e
commit dd7d6188f2
4 changed files with 24 additions and 16 deletions

View File

@ -71,7 +71,7 @@ angular.module('syncthing.core')
simpleKeep: 5,
staggeredMaxAge: 365,
staggeredCleanInterval: 3600,
staggeredVersionsPath: "",
versionsPath: "",
externalCommand: "",
};
@ -1902,17 +1902,19 @@ angular.module('syncthing.core')
case "trashcan":
$scope.currentFolder._guiVersioning.selector = "trashcan";
$scope.currentFolder._guiVersioning.trashcanClean = +currentVersioning.params.cleanoutDays;
$scope.currentFolder._guiVersioning.versionsPath = currentVersioning.params.versionsPath;
break;
case "simple":
$scope.currentFolder._guiVersioning.selector = "simple";
$scope.currentFolder._guiVersioning.simpleKeep = +currentVersioning.params.keep;
$scope.currentFolder._guiVersioning.trashcanClean = +currentVersioning.params.cleanoutDays;
$scope.currentFolder._guiVersioning.versionsPath = currentVersioning.params.versionsPath;
break;
case "staggered":
$scope.currentFolder._guiVersioning.selector = "staggered";
$scope.currentFolder._guiVersioning.staggeredMaxAge = Math.floor(+currentVersioning.params.maxAge / 86400);
$scope.currentFolder._guiVersioning.staggeredCleanInterval = +currentVersioning.params.cleanInterval;
$scope.currentFolder._guiVersioning.staggeredVersionsPath = currentVersioning.params.versionsPath;
$scope.currentFolder._guiVersioning.versionsPath = currentVersioning.params.versionsPath;
break;
case "external":
$scope.currentFolder._guiVersioning.selector = "external";
@ -2041,7 +2043,8 @@ angular.module('syncthing.core')
folderCfg.versioning = {
'type': 'trashcan',
'params': {
'cleanoutDays': '' + folderCfg._guiVersioning.trashcanClean
'cleanoutDays': '' + folderCfg._guiVersioning.trashcanClean,
'versionsPath': '' + folderCfg._guiVersioning.versionsPath
},
'cleanupIntervalS': folderCfg._guiVersioning.cleanupIntervalS
};
@ -2051,7 +2054,8 @@ angular.module('syncthing.core')
'type': 'simple',
'params': {
'keep': '' + folderCfg._guiVersioning.simpleKeep,
'cleanoutDays': '' + folderCfg._guiVersioning.trashcanClean
'cleanoutDays': '' + folderCfg._guiVersioning.trashcanClean,
'versionsPath': '' + folderCfg._guiVersioning.versionsPath
},
'cleanupIntervalS': folderCfg._guiVersioning.cleanupIntervalS
};
@ -2062,7 +2066,7 @@ angular.module('syncthing.core')
'params': {
'maxAge': '' + (folderCfg._guiVersioning.staggeredMaxAge * 86400),
'cleanInterval': '' + folderCfg._guiVersioning.staggeredCleanInterval,
'versionsPath': '' + folderCfg._guiVersioning.staggeredVersionsPath
'versionsPath': '' + folderCfg._guiVersioning.versionsPath
},
'cleanupIntervalS': folderCfg._guiVersioning.cleanupIntervalS
};

View File

@ -132,9 +132,9 @@
<span translate ng-if="folderEditor._guiVersioning.staggeredMaxAge.$error.min && folderEditor._guiVersioning.staggeredMaxAge.$dirty">A negative number of days doesn't make sense.</span>
</p>
</div>
<div class="form-group" ng-if="currentFolder._guiVersioning.selector == 'staggered'">
<label translate for="staggeredVersionsPath">Versions Path</label>
<input name="staggeredVersionsPath" id="staggeredVersionsPath" class="form-control" type="text" ng-model="currentFolder._guiVersioning.staggeredVersionsPath" />
<div class="form-group" ng-if="currentFolder._guiVersioning.selector != 'none' && currentFolder._guiVersioning.selector != 'external'">
<label translate for="versionsPath">Versions Path</label>
<input name="versionsPath" id="versionsPath" class="form-control" type="text" ng-model="currentFolder._guiVersioning.versionsPath" />
<p translate class="help-block">Path where versions should be stored (leave empty for the default .stversions directory in the shared folder).</p>
</div>
<div class="form-group" ng-if="currentFolder._guiVersioning.selector=='external'" ng-class="{'has-error': folderEditor.externalCommand.$invalid && folderEditor.externalCommand.$dirty}">

View File

@ -71,7 +71,7 @@ angular.module('syncthing.core')
simpleKeep: 5,
staggeredMaxAge: 365,
staggeredCleanInterval: 3600,
staggeredVersionsPath: "",
versionsPath: "",
externalCommand: "",
};
@ -1919,17 +1919,19 @@ angular.module('syncthing.core')
case "trashcan":
$scope.currentFolder._guiVersioning.selector = "trashcan";
$scope.currentFolder._guiVersioning.trashcanClean = +currentVersioning.params.cleanoutDays;
$scope.currentFolder._guiVersioning.versionsPath = currentVersioning.params.versionsPath;
break;
case "simple":
$scope.currentFolder._guiVersioning.selector = "simple";
$scope.currentFolder._guiVersioning.simpleKeep = +currentVersioning.params.keep;
$scope.currentFolder._guiVersioning.trashcanClean = +currentVersioning.params.cleanoutDays;
$scope.currentFolder._guiVersioning.versionsPath = currentVersioning.params.versionsPath;
break;
case "staggered":
$scope.currentFolder._guiVersioning.selector = "staggered";
$scope.currentFolder._guiVersioning.staggeredMaxAge = Math.floor(+currentVersioning.params.maxAge / 86400);
$scope.currentFolder._guiVersioning.staggeredCleanInterval = +currentVersioning.params.cleanInterval;
$scope.currentFolder._guiVersioning.staggeredVersionsPath = currentVersioning.params.versionsPath;
$scope.currentFolder._guiVersioning.versionsPath = currentVersioning.params.versionsPath;
break;
case "external":
$scope.currentFolder._guiVersioning.selector = "external";
@ -2060,7 +2062,8 @@ angular.module('syncthing.core')
folderCfg.versioning = {
'type': 'trashcan',
'params': {
'cleanoutDays': '' + folderCfg._guiVersioning.trashcanClean
'cleanoutDays': '' + folderCfg._guiVersioning.trashcanClean,
'versionsPath': '' + folderCfg._guiVersioning.versionsPath
},
'cleanupIntervalS': folderCfg._guiVersioning.cleanupIntervalS
};
@ -2070,7 +2073,8 @@ angular.module('syncthing.core')
'type': 'simple',
'params': {
'keep': '' + folderCfg._guiVersioning.simpleKeep,
'cleanoutDays': '' + folderCfg._guiVersioning.trashcanClean
'cleanoutDays': '' + folderCfg._guiVersioning.trashcanClean,
'versionsPath': '' + folderCfg._guiVersioning.versionsPath
},
'cleanupIntervalS': folderCfg._guiVersioning.cleanupIntervalS
};
@ -2081,7 +2085,7 @@ angular.module('syncthing.core')
'params': {
'maxAge': '' + (folderCfg._guiVersioning.staggeredMaxAge * 86400),
'cleanInterval': '' + folderCfg._guiVersioning.staggeredCleanInterval,
'versionsPath': '' + folderCfg._guiVersioning.staggeredVersionsPath
'versionsPath': '' + folderCfg._guiVersioning.versionsPath
},
'cleanupIntervalS': folderCfg._guiVersioning.cleanupIntervalS
};

View File

@ -120,9 +120,9 @@
<span translate ng-if="folderEditor._guiVersioning.staggeredMaxAge.$error.min && folderEditor._guiVersioning.staggeredMaxAge.$dirty">A negative number of days doesn't make sense.</span>
</p>
</div>
<div class="form-group" ng-if="currentFolder._guiVersioning.selector == 'staggered'">
<label translate for="staggeredVersionsPath">Versions Path</label>
<input name="staggeredVersionsPath" id="staggeredVersionsPath" class="form-control" type="text" ng-model="currentFolder._guiVersioning.staggeredVersionsPath" />
<div class="form-group" ng-if="currentFolder._guiVersioning.selector != 'none' && currentFolder._guiVersioning.selector != 'external'">
<label translate for="versionsPath">Versions Path</label>
<input name="versionsPath" id="versionsPath" class="form-control" type="text" ng-model="currentFolder._guiVersioning.versionsPath" />
<p translate class="help-block">Path where versions should be stored (leave empty for the default .stversions directory in the shared folder).</p>
</div>
<div class="form-group" ng-if="currentFolder._guiVersioning.selector=='external'" ng-class="{'has-error': folderEditor.externalCommand.$invalid && folderEditor.externalCommand.$dirty}">