gui: Add default ignores to the advanced configuration editor modal (fixes #8264) (#8265)

This commit is contained in:
André Colomb 2022-05-08 21:34:03 +02:00 committed by GitHub
parent 97291c9184
commit 2bcaa17fc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 0 deletions

View File

@ -75,6 +75,7 @@
"Default Device": "Default Device", "Default Device": "Default Device",
"Default Folder": "Default Folder", "Default Folder": "Default Folder",
"Default Folder Path": "Default Folder Path", "Default Folder Path": "Default Folder Path",
"Default Ignore Patterns": "Default Ignore Patterns",
"Defaults": "Defaults", "Defaults": "Defaults",
"Delete": "Delete", "Delete": "Delete",
"Delete Unexpected Items": "Delete Unexpected Items", "Delete Unexpected Items": "Delete Unexpected Items",

View File

@ -2860,6 +2860,12 @@ angular.module('syncthing.core')
$scope.advancedConfig = angular.copy($scope.config); $scope.advancedConfig = angular.copy($scope.config);
$scope.advancedConfig.devices.sort(deviceCompare); $scope.advancedConfig.devices.sort(deviceCompare);
$scope.advancedConfig.folders.sort(folderCompare); $scope.advancedConfig.folders.sort(folderCompare);
$scope.advancedConfig.defaults.ignores._lines = function (newValue) {
if (arguments.length) {
$scope.advancedConfig.defaults.ignores.lines = newValue.split('\n');
}
return $scope.advancedConfig.defaults.ignores.lines.join('\n');
};
$('#advanced').modal('show'); $('#advanced').modal('show');
}; };

View File

@ -167,6 +167,26 @@
</form> </form>
</div> </div>
</div> </div>
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="advancedDefaultIgnoresHeading" data-toggle="collapse" data-parent="#advancedDefaults" href="#advancedDefaultIgnores" aria-expanded="false" aria-controls="advancedDefaultIgnores" style="cursor: pointer;">
<h4 class="panel-title" tabindex="0" translate>Default Ignore Patterns</h4>
</div>
<div id="advancedDefaultIgnores" class="panel-collapse collapse" role="tabpanel" aria-labelledby="advancedDefaultIgnoresHeading">
<form class="form-horizontal" role="form">
<div ng-repeat="(key, value) in advancedConfig.defaults.ignores" ng-if="inputTypeFor(key, value) != 'skip'" class="form-group">
<label for="advancedDefaultIgnoresInput{{$index}}" class="col-sm-4 control-label">{{key | uncamel}}&nbsp;<a href="{{docsURL('users/config#config-option-defaults.ignores.')}}{{key | lowercase}}" target="_blank"><span class="fas fa-question-circle"></span></a></label>
<div class="col-sm-8">
<div ng-switch="key">
<!-- Special case to preserve empty lines in multi-line input -->
<textarea ng-switch-when="lines" id="advancedDefaultIgnoresInput{{$index}}" class="form-control" rows="5" ng-model="advancedConfig.defaults.ignores._lines" ng-model-options="{ getterSetter: true }"></textarea>
<input ng-switch-default ng-if="inputTypeFor(key, value) == 'list'" id="advancedDefaultIgnoresInput{{$index}}" class="form-control" type="text" ng-model="advancedConfig.defaults.ignores[key]" ng-list />
<input ng-switch-default ng-if="inputTypeFor(key, value) != 'list'" id="advancedDefaultIgnoresInput{{$index}}" class="form-control" type="{{inputTypeFor(key, value)}}" ng-model="advancedConfig.defaults.ignores[key]" />
</div>
</div>
</div>
</form>
</div>
</div>
</div> </div>
</div> </div>