Added drop down
This commit is contained in:
parent
9914fbce12
commit
f586ecf708
2 changed files with 46 additions and 12 deletions
|
|
@ -7,21 +7,42 @@ angular.module('copayApp.controllers').controller('SettingsController', function
|
|||
$scope.defaultLanguage = config.defaultLanguage || 'en';
|
||||
$scope.insightLivenet = config.network.livenet.url;
|
||||
$scope.insightTestnet = config.network.testnet.url;
|
||||
$scope.defaultLogLevel = config.logLevel || 'log';
|
||||
|
||||
|
||||
|
||||
//$scope.availableLogLevels = logger.levels;
|
||||
|
||||
$scope.availableLogLevels = {
|
||||
'debug': 0,
|
||||
'info': 1,
|
||||
'log': 2,
|
||||
'warn': 3,
|
||||
'error': 4,
|
||||
'fatal': 5
|
||||
};
|
||||
|
||||
console.log($scope.defaultLogLevel);
|
||||
console.log($scope.availableLogLevels);
|
||||
|
||||
for (var key in $scope.availableLogLevels) {
|
||||
console.log("Ele " + key + " -- " + $scope.availableLogLevels[key])
|
||||
}
|
||||
|
||||
$scope.availableStorages = [{
|
||||
name: 'Insight',
|
||||
pluginName: 'EncryptedInsightStorage',
|
||||
}, {
|
||||
name: 'Localstorage',
|
||||
pluginName: 'EncryptedLocalStorage',
|
||||
},
|
||||
// {
|
||||
// name: 'GoogleDrive',
|
||||
// pluginName: 'GoogleDrive',
|
||||
// }
|
||||
name: 'Insight',
|
||||
pluginName: 'EncryptedInsightStorage',
|
||||
}, {
|
||||
name: 'Localstorage',
|
||||
pluginName: 'EncryptedLocalStorage',
|
||||
},
|
||||
// {
|
||||
// name: 'GoogleDrive',
|
||||
// pluginName: 'GoogleDrive',
|
||||
// }
|
||||
];
|
||||
|
||||
_.each($scope.availableStorages, function(v){
|
||||
_.each($scope.availableStorages, function(v) {
|
||||
if (config.plugins[v.pluginName])
|
||||
$scope.selectedStorage = v;
|
||||
});
|
||||
|
|
@ -41,6 +62,13 @@ angular.module('copayApp.controllers').controller('SettingsController', function
|
|||
}
|
||||
}
|
||||
|
||||
for (var ii in $scope.availableLogLevels) {
|
||||
if ($scope.defaultLogLevel === $scope.availableLogLevels[ii]) {
|
||||
$scope.selectedLogLevel = $scope.availableLogLevels[ii];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$scope.save = function() {
|
||||
$scope.insightLivenet = copay.Insight.setCompleteUrl($scope.insightLivenet);
|
||||
|
|
@ -59,11 +87,14 @@ angular.module('copayApp.controllers').controller('SettingsController', function
|
|||
var plugins = {};
|
||||
plugins[$scope.selectedStorage.pluginName] = true;
|
||||
|
||||
logger.setLevel($scope.selectedLogLevel);
|
||||
|
||||
localStorage.setItem('config', JSON.stringify({
|
||||
network: insightSettings,
|
||||
version: copay.version,
|
||||
defaultLanguage: $scope.selectedLanguage.isoCode,
|
||||
plugins: plugins,
|
||||
logLevel: $scope.selectedLogLevel,
|
||||
}));
|
||||
|
||||
// Go home reloading the application
|
||||
|
|
|
|||
|
|
@ -35,7 +35,10 @@
|
|||
Wallets and profiles are stored encrypted using your password as a key. You can store the encrypted data locally, on your platform, or remotely on the Insight Server. <a target="_blank" href="https://github.com/bitpay/copay/tree/master/js/plugins">More pluggins are welcomed!</a>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<legend translate>Log level</legend>
|
||||
<select class="form-control" ng-model="selectedLogLevel" ng-options="o for o in availableLogLevels" required>
|
||||
</select>
|
||||
</fieldset>
|
||||
<button translate type="submit" class="button primary radius expand m0" ng-disabled="settingsForm.$invalid || loading" ng-click="save()">
|
||||
Save
|
||||
</button>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue