mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-08 22:31:04 +00:00
Added suggestions to settings fix.
This commit is contained in:
parent
63c0f11458
commit
a97985b428
File diff suppressed because one or more lines are too long
12
gui/app.js
12
gui/app.js
@ -10,7 +10,6 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) {
|
|||||||
var prevDate = 0;
|
var prevDate = 0;
|
||||||
var getOK = true;
|
var getOK = true;
|
||||||
var restarting = false;
|
var restarting = false;
|
||||||
var oldOptions = {};
|
|
||||||
|
|
||||||
$scope.connections = {};
|
$scope.connections = {};
|
||||||
$scope.config = {};
|
$scope.config = {};
|
||||||
@ -255,13 +254,20 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.editSettings = function () {
|
$scope.editSettings = function () {
|
||||||
oldOptions = angular.copy($scope.config.Options);
|
// Make a working copy
|
||||||
|
$scope.config.workingOptions = angular.copy($scope.config.Options);
|
||||||
|
$scope.config.workingGUI = angular.copy($scope.config.GUI);
|
||||||
$('#settings').modal({backdrop: 'static', keyboard: true});
|
$('#settings').modal({backdrop: 'static', keyboard: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.saveSettings = function () {
|
$scope.saveSettings = function () {
|
||||||
// Make sure something changed
|
// Make sure something changed
|
||||||
if(! angular.equals(oldOptions, $scope.config.Options)){
|
var changed = ! angular.equals($scope.config.Options, $scope.config.workingOptions) ||
|
||||||
|
! angular.equals($scope.config.GUI, $scope.config.workingGUI);
|
||||||
|
if(changed){
|
||||||
|
$scope.config.Options = angular.copy($scope.config.workingOptions);
|
||||||
|
$scope.config.GUI = angular.copy($scope.config.workingGUI);
|
||||||
|
|
||||||
$scope.configInSync = false;
|
$scope.configInSync = false;
|
||||||
$scope.config.Options.ListenAddress = $scope.config.Options.ListenStr.split(',').map(function (x) { return x.trim(); });
|
$scope.config.Options.ListenAddress = $scope.config.Options.ListenStr.split(',').map(function (x) { return x.trim(); });
|
||||||
$http.post(urlbase + '/config', JSON.stringify($scope.config), {headers: {'Content-Type': 'application/json'}});
|
$http.post(urlbase + '/config', JSON.stringify($scope.config), {headers: {'Content-Type': 'application/json'}});
|
||||||
|
@ -515,11 +515,11 @@
|
|||||||
<div class="form-group" ng-repeat="setting in settings">
|
<div class="form-group" ng-repeat="setting in settings">
|
||||||
<div ng-if="setting.type == 'text' || setting.type == 'number'">
|
<div ng-if="setting.type == 'text' || setting.type == 'number'">
|
||||||
<label for="{{setting.id}}">{{setting.descr}}</label>
|
<label for="{{setting.id}}">{{setting.descr}}</label>
|
||||||
<input id="{{setting.id}}" class="form-control" type="{{setting.type}}" ng-model="config.Options[setting.id]"></input>
|
<input id="{{setting.id}}" class="form-control" type="{{setting.type}}" ng-model="config.workingOptions[setting.id]"></input>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox" ng-if="setting.type == 'bool'">
|
<div class="checkbox" ng-if="setting.type == 'bool'">
|
||||||
<label>
|
<label>
|
||||||
{{setting.descr}} <input id="{{setting.id}}" type="checkbox" ng-model="config.Options[setting.id]"></input>
|
{{setting.descr}} <input id="{{setting.id}}" type="checkbox" ng-model="config.workingOptions[setting.id]"></input>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -528,11 +528,11 @@
|
|||||||
<div class="form-group" ng-repeat="setting in guiSettings">
|
<div class="form-group" ng-repeat="setting in guiSettings">
|
||||||
<div ng-if="setting.type == 'text' || setting.type == 'number' || setting.type == 'password'">
|
<div ng-if="setting.type == 'text' || setting.type == 'number' || setting.type == 'password'">
|
||||||
<label for="{{setting.id}}">{{setting.descr}}</label>
|
<label for="{{setting.id}}">{{setting.descr}}</label>
|
||||||
<input id="{{setting.id}}" class="form-control" type="{{setting.type}}" ng-model="config.GUI[setting.id]"></input>
|
<input id="{{setting.id}}" class="form-control" type="{{setting.type}}" ng-model="config.workingGUI[setting.id]"></input>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox" ng-if="setting.type == 'bool'">
|
<div class="checkbox" ng-if="setting.type == 'bool'">
|
||||||
<label>
|
<label>
|
||||||
{{setting.descr}} <input id="{{setting.id}}" type="checkbox" ng-model="config.GUI[setting.id]"></input>
|
{{setting.descr}} <input id="{{setting.id}}" type="checkbox" ng-model="config.workingGUI[setting.id]"></input>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user