all: Transition to using fs watcher by default (fixes #4552)
This commit is contained in:
committed by
Audrius Butkevicius
parent
d6bb8e6e06
commit
a557d62c4a
@@ -41,3 +41,31 @@
|
||||
</div>
|
||||
</div>
|
||||
</notification>
|
||||
|
||||
<notification id="fsWatcherNotification">
|
||||
<div class="panel panel-success">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title"><span class="fa fa-flash"></span> <span translate>Watching for Changes</span></h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<p translate>Continuously watching for changes is now available within Syncthing. This will detect changes on disk and issue a scan on only the modified paths. The benefits are that changes are propagated quicker and that less full scans are required.</p>
|
||||
<p><a href="https://docs.syncthing.net/users/syncing.html#scanning"><span class="fa fa-fw fa-book"></span> <span translate>Learn more</span></a></p>
|
||||
<p>
|
||||
<span translate>Do you want to enable watching for changes for all your folders?</span><br/>
|
||||
<span translate>Additionally the full rescan interval will be increased (times 60, i.e. new default of 1h). You can also configure it manually for every folder later after choosing No.</span>
|
||||
</p>
|
||||
<p translate translate-value-syncthing-inotify="syncthing-inotify">Warning: If you are using an external watcher like {%syncthingInotify%}, you should make sure it is deactivated.</p>
|
||||
</div>
|
||||
<div class="panel-footer clearfix">
|
||||
<div class="pull-right">
|
||||
<button type="button" class="btn btn-primary btn-sm" ng-click="activateAllFsWatchers(); dismiss()">
|
||||
<span class="fa fa-check"></span> <span translate>Yes</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-default btn-sm" ng-click="dismiss()">
|
||||
<span class="fa fa-times"></span> <span translate>No</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
</notification>
|
||||
|
||||
@@ -53,6 +53,7 @@ angular.module('syncthing.core')
|
||||
$scope.globalChangeEvents = {};
|
||||
$scope.metricRates = false;
|
||||
$scope.folderPathErrors = {};
|
||||
$scope.currentFolder = {};
|
||||
resetRemoteNeed();
|
||||
|
||||
try {
|
||||
@@ -62,8 +63,9 @@ angular.module('syncthing.core')
|
||||
$scope.folderDefaults = {
|
||||
selectedDevices: {},
|
||||
type: "readwrite",
|
||||
rescanIntervalS: 60,
|
||||
rescanIntervalS: 3600,
|
||||
fsWatcherDelayS: 10,
|
||||
fsWatcherEnabled: true,
|
||||
minDiskFree: {value: 1, unit: "%"},
|
||||
maxConflicts: 10,
|
||||
fsync: true,
|
||||
@@ -1504,6 +1506,14 @@ angular.module('syncthing.core')
|
||||
$scope.currentFolder.path = pathJoin($scope.config.options.defaultFolderPath, newvalue);
|
||||
});
|
||||
|
||||
$scope.$watch('currentFolder.fsWatcherEnabled', function (newvalue) {
|
||||
if (newvalue) {
|
||||
$scope.currentFolder.rescanIntervalS = 3600;
|
||||
} else {
|
||||
$scope.currentFolder.rescanIntervalS = 60;
|
||||
}
|
||||
});
|
||||
|
||||
$scope.loadFormIntoScope = function (form) {
|
||||
console.log('loadFormIntoScope',form.$name);
|
||||
switch (form.$name) {
|
||||
@@ -2126,6 +2136,28 @@ angular.module('syncthing.core')
|
||||
return false;
|
||||
};
|
||||
|
||||
$scope.activateAllFsWatchers = function() {
|
||||
var folders = $scope.folderList();
|
||||
|
||||
$.each(folders, function(i) {
|
||||
if (folders[i].fsWatcherEnabled) {
|
||||
return;
|
||||
}
|
||||
folders[i].fsWatcherEnabled = true;
|
||||
if (folders[i].rescanIntervalS === 0) {
|
||||
return;
|
||||
}
|
||||
// Delay full scans, but scan at least once per day
|
||||
folders[i].rescanIntervalS *= 60;
|
||||
if (folders[i].rescanIntervalS > 86400) {
|
||||
folders[i].rescanIntervalS = 86400;
|
||||
}
|
||||
});
|
||||
|
||||
$scope.config.folders = folders;
|
||||
$scope.saveConfig();
|
||||
};
|
||||
|
||||
$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.
|
||||
|
||||
@@ -133,26 +133,75 @@
|
||||
<div class="pull-left" ng-show="!editingExisting"><span translate translate-value-path="{{currentFolder.path}}{{system.pathSeparator}}.stignore">Creating ignore patterns, overwriting an existing file at {%path%}.</span></div>
|
||||
</div>
|
||||
<div id="folder-advanced" class="tab-pane">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group" ng-class="{'has-error': folderEditor.rescanIntervalS.$invalid && folderEditor.rescanIntervalS.$dirty}">
|
||||
<label for="rescanIntervalS"><span translate>Rescan Interval</span> (s)</label><br/>
|
||||
<input name="rescanIntervalS" id="rescanIntervalS" class="form-control" type="number" ng-model="currentFolder.rescanIntervalS" required="" aria-required="true" min="0"/>
|
||||
<p class="help-block">
|
||||
<span translate ng-if="!folderEditor.rescanIntervalS.$valid && folderEditor.rescanIntervalS.$dirty">The rescan interval must be a non-negative number of seconds.</span>
|
||||
</p>
|
||||
<div class="row form-group" ng-class="{'has-error': folderEditor.rescanIntervalS.$invalid && folderEditor.rescanIntervalS.$dirty}">
|
||||
<div class="col-md-12">
|
||||
<label translate>Scanning</label>
|
||||
<a href="https://docs.syncthing.net/users/syncing.html#scanning" target="_blank"><span class="fa fa-book"></span> <span translate>Help</span></a></br>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<input type="checkbox" ng-model="currentFolder.fsWatcherEnabled" tooltip data-original-title="{{'Use notifications from the filesystem to detect changed items.' | translate }}"> <span translate>Watch for Changes</span>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="row">
|
||||
<span class="col-md-8" translate>Full Rescan Interval (s)</span>
|
||||
<div class="col-md-4">
|
||||
<input name="rescanIntervalS" id="rescanIntervalS" class="form-control" type="number" ng-model="currentFolder.rescanIntervalS" required="" aria-required="true" min="0"/>
|
||||
</div>
|
||||
</div>
|
||||
<p class="help-block" ng-if="!folderEditor.rescanIntervalS.$valid && folderEditor.rescanIntervalS.$dirty" translate>
|
||||
The rescan interval must be a non-negative number of seconds.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 form-horizontal">
|
||||
<div class="form-group" ng-class="{'has-error': folderEditor.minDiskFree.$invalid && folderEditor.minDiskFree.$dirty}">
|
||||
<label class="col-xs-12" for="minDiskFree"><span translate>Minimum Free Disk Space</span></label><br/>
|
||||
<div class="col-xs-9"><input name="minDiskFree" id="minDiskFree" class="form-control" type="number" ng-model="currentFolder.minDiskFree.value" required="" aria-required="true" min="0" step="0.01"/></div>
|
||||
<div class="col-xs-3"><select class="col-sm-3 form-control" ng-model="currentFolder.minDiskFree.unit">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6 form-group">
|
||||
<label translate>Folder Type</label>
|
||||
<a href="https://docs.syncthing.net/users/foldertypes.html" target="_blank"><span class="fa fa-book"></span> <span translate>Help</span></a>
|
||||
<select class="form-control" ng-model="currentFolder.type">
|
||||
<option value="readwrite" translate>Send & Receive</option>
|
||||
<option value="readonly" translate>Send Only</option>
|
||||
</select>
|
||||
<p ng-if="currentFolder.type == 'readonly'" translate class="help-block">Files are protected from changes made on other devices, but changes made on this device will be sent to the rest of the cluster.</p>
|
||||
</div>
|
||||
<div class="col-md-6 form-group">
|
||||
<label translate>File Pull Order</label>
|
||||
<select class="form-control" ng-model="currentFolder.order">
|
||||
<option value="random" translate>Random</option>
|
||||
<option value="alphabetic" translate>Alphabetic</option>
|
||||
<option value="smallestFirst" translate>Smallest First</option>
|
||||
<option value="largestFirst" translate>Largest First</option>
|
||||
<option value="oldestFirst" translate>Oldest First</option>
|
||||
<option value="newestFirst" translate>Newest First</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6 form-horizontal form-group" ng-class="{'has-error': folderEditor.minDiskFree.$invalid && folderEditor.minDiskFree.$dirty}">
|
||||
<label for="minDiskFree" translate>Minimum Free Disk Space</label><br/>
|
||||
<div class="row">
|
||||
<div class="col-md-9">
|
||||
<input name="minDiskFree" id="minDiskFree" class="form-control" type="number" ng-model="currentFolder.minDiskFree.value" required="" aria-required="true" min="0" step="0.01"/>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<select class="form-control" ng-model="currentFolder.minDiskFree.unit">
|
||||
<option value="%">%</option>
|
||||
<option value="kB">kB</option>
|
||||
<option value="MB">MB</option>
|
||||
<option value="GB">GB</option>
|
||||
<option value="TB">TB</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<p class="help-block" ng-show="folderEditor.minDiskFree.$invalid" translate>
|
||||
Enter a non-negative number (e.g., "2.35") and select a unit. Percentages are as part of the total disk size.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-6 form-group">
|
||||
<label translate>Permissions</label><br/>
|
||||
<input type="checkbox" ng-model="currentFolder.ignorePerms"/> <span translate>Ignore</span>
|
||||
<p translate class="help-block">File permission bits are ignored when looking for changes. Use on FAT file systems.</p>
|
||||
</select></div>
|
||||
<p class="col-xs-12 help-block" ng-show="folderEditor.minDiskFree.$invalid">
|
||||
<span translate>Enter a non-negative number (e.g., "2.35") and select a unit. Percentages are as part of the total disk size.</span>
|
||||
@@ -160,43 +209,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<!-- Left column -->
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label translate>Folder Type</label>
|
||||
<a href="https://docs.syncthing.net/users/foldertypes.html" target="_blank"><span class="fa fa-book"></span> <span translate>Help</span></a>
|
||||
<select class="form-control" ng-model="currentFolder.type">
|
||||
<option value="readwrite" translate>Send & Receive</option>
|
||||
<option value="readonly" translate>Send Only</option>
|
||||
</select>
|
||||
<p ng-if="currentFolder.type == 'readonly'" translate class="help-block">Files are protected from changes made on other devices, but changes made on this device will be sent to the rest of the cluster.</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" ng-model="currentFolder.ignorePerms"/> <span translate>Ignore Permissions</span>
|
||||
</label>
|
||||
</div>
|
||||
<p translate class="help-block">File permission bits are ignored when looking for changes. Use on FAT file systems.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Right column-->
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label translate>File Pull Order</label>
|
||||
<select class="form-control" ng-model="currentFolder.order">
|
||||
<option value="random" translate>Random</option>
|
||||
<option value="alphabetic" translate>Alphabetic</option>
|
||||
<option value="smallestFirst" translate>Smallest First</option>
|
||||
<option value="largestFirst" translate>Largest First</option>
|
||||
<option value="oldestFirst" translate>Oldest First</option>
|
||||
<option value="newestFirst" translate>Newest First</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user