mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-22 22:58:25 +00:00
gui: Handle slices in advanced config, show devices in advanced config (fixes #2267)
The ng-list directive makes angular handle lists by doing comma separation in the roundtrip. We could simplify our normal config dialog this way as well... Also adds devices that were inexplicably not available in the advanced config. This reveals some other uglyness, as the "devices" config of a folder now shows as "[object Object], [object Object]" - previously it was invisible. I think that's fine for now. GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4071
This commit is contained in:
parent
b75b4190c8
commit
cbdb036b69
@ -1743,6 +1743,9 @@ angular.module('syncthing.core')
|
|||||||
if (typeof value === 'boolean') {
|
if (typeof value === 'boolean') {
|
||||||
return 'checkbox';
|
return 'checkbox';
|
||||||
}
|
}
|
||||||
|
if (value instanceof Array) {
|
||||||
|
return 'list';
|
||||||
|
}
|
||||||
if (typeof value === 'object') {
|
if (typeof value === 'object') {
|
||||||
return 'skip';
|
return 'skip';
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
<div ng-repeat="(key, value) in advancedConfig.gui" ng-init="type = inputTypeFor(key, value)" ng-if="type != 'skip'" class="form-group">
|
<div ng-repeat="(key, value) in advancedConfig.gui" ng-init="type = inputTypeFor(key, value)" ng-if="type != 'skip'" class="form-group">
|
||||||
<label for="guiInput{{$index}}" class="col-sm-4 control-label">{{key}}</label>
|
<label for="guiInput{{$index}}" class="col-sm-4 control-label">{{key}}</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input id="guiInput{{$index}}" class="form-control" type="{{type}}" ng-model="advancedConfig.gui[key]" />
|
<input ng-if="inputTypeFor(key, value) == 'list'" id="optionsInput{{$index}}" class="form-control" type="text" ng-model="advancedConfig.gui[key]" ng-list/>
|
||||||
|
<input ng-if="inputTypeFor(key, value) != 'list'" id="optionsInput{{$index}}" class="form-control" type="{{inputTypeFor(key, value)}}" ng-model="advancedConfig.gui[key]" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@ -36,7 +37,8 @@
|
|||||||
<div ng-repeat="(key, value) in advancedConfig.options" ng-if="inputTypeFor(key, value) != 'skip'" class="form-group">
|
<div ng-repeat="(key, value) in advancedConfig.options" ng-if="inputTypeFor(key, value) != 'skip'" class="form-group">
|
||||||
<label for="optionsInput{{$index}}" class="col-sm-4 control-label">{{key}}</label>
|
<label for="optionsInput{{$index}}" class="col-sm-4 control-label">{{key}}</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input id="optionsInput{{$index}}" class="form-control" type="{{inputTypeFor(key, value)}}" ng-model="advancedConfig.options[key]" />
|
<input ng-if="inputTypeFor(key, value) == 'list'" id="optionsInput{{$index}}" class="form-control" type="text" ng-model="advancedConfig.options[key]" ng-list/>
|
||||||
|
<input ng-if="inputTypeFor(key, value) != 'list'" id="optionsInput{{$index}}" class="form-control" type="{{inputTypeFor(key, value)}}" ng-model="advancedConfig.options[key]" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@ -59,7 +61,29 @@
|
|||||||
<div ng-repeat="(key, value) in folder" ng-if="inputTypeFor(key, value) != 'skip'" class="form-group">
|
<div ng-repeat="(key, value) in folder" ng-if="inputTypeFor(key, value) != 'skip'" class="form-group">
|
||||||
<label for="folder{{$index}}Input{{$index}}" class="col-sm-4 control-label">{{key}}</label>
|
<label for="folder{{$index}}Input{{$index}}" class="col-sm-4 control-label">{{key}}</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input id="folder{{$index}}Input{{$index}}" class="form-control" type="{{inputTypeFor(key, value)}}" ng-model="folder[key]" />
|
<input ng-if="inputTypeFor(key, value) == 'list'" id="optionsInput{{$index}}" class="form-control" type="text" ng-model="folder[key]" ng-list/>
|
||||||
|
<input ng-if="inputTypeFor(key, value) != 'list'" id="optionsInput{{$index}}" class="form-control" type="{{inputTypeFor(key, value)}}" ng-model="folder[key]" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="panel panel-default" ng-repeat="device in advancedConfig.devices">
|
||||||
|
<div class="panel-heading" role="tab" id="device{{$index}}Heading" data-toggle="collapse" data-parent="#advancedAccordion" href="#device{{$index}}Config" aria-expanded="false" aria-controls="folder{{$index}}Config" style="cursor: pointer;">
|
||||||
|
<h4 class="panel-title" tabindex="0">
|
||||||
|
<span translate>Device</span> "{{deviceName(device)}}"
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
<div id="device{{$index}}Config" class="panel-collapse collapse" role="tabpanel" aria-labelledby="device{{$index}}Heading">
|
||||||
|
<div class="panel-body">
|
||||||
|
<form class="form-horizontal" role="form">
|
||||||
|
<div ng-repeat="(key, value) in device" ng-if="inputTypeFor(key, value) != 'skip'" class="form-group">
|
||||||
|
<label for="device{{$index}}Input{{$index}}" class="col-sm-4 control-label">{{key}}</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input ng-if="inputTypeFor(key, value) == 'list'" id="optionsInput{{$index}}" class="form-control" type="text" ng-model="device[key]" ng-list/>
|
||||||
|
<input ng-if="inputTypeFor(key, value) != 'list'" id="optionsInput{{$index}}" class="form-control" type="{{inputTypeFor(key, value)}}" ng-model="device[key]" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@ -76,7 +100,7 @@
|
|||||||
<span class="fa fa-times"></span> <span translate>Close</span>
|
<span class="fa fa-times"></span> <span translate>Close</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</modal>
|
</modal>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user