add advanced options to import

This commit is contained in:
Matias Alejo Garcia 2014-08-21 11:50:40 -04:00
parent 96b841bd51
commit db1b7d7c45
3 changed files with 41 additions and 10 deletions

View File

@ -7,10 +7,7 @@ angular.module('copayApp.controllers').controller('ImportController',
$scope.title = 'Import a backup'; $scope.title = 'Import a backup';
$scope.importStatus = 'Importing wallet - Reading backup...'; $scope.importStatus = 'Importing wallet - Reading backup...';
var s = ($location.search()).skip; $scope.hideAdv=true;
if (s) {
$scope.skipFields = s.split(',');
}
var reader = new FileReader(); var reader = new FileReader();
@ -24,9 +21,20 @@ angular.module('copayApp.controllers').controller('ImportController',
updateStatus('Importing wallet - Setting things up...'); updateStatus('Importing wallet - Setting things up...');
var w, errMsg; var w, errMsg;
var skipFields = [];
if ($scope.skipPublicKeyRing)
skipFields.push('publicKeyRing');
if ($scope.skipTxProposals)
skipFields.push('txProposals');
if ($scope.skipPrivateKey)
skipFields.push('privateKey');
console.log('[import.js.36:skipFields:]',skipFields); //TODO
// try to import encrypted wallet with passphrase // try to import encrypted wallet with passphrase
try { try {
w = walletFactory.import(encryptedObj, passphrase, $scope.skipFields); w = walletFactory.import(encryptedObj, passphrase, skipFields);
} catch (e) { } catch (e) {
errMsg = e.message; errMsg = e.message;
} }

View File

@ -17,11 +17,34 @@
<fieldset> <fieldset>
<legend for="backupFile" class="m10b"> Choose backup file from your computer <i class="fi-laptop"></i></legend> <legend for="backupFile" class="m10b"> Choose backup file from your computer <i class="fi-laptop"></i></legend>
<input type="file" class="form-control" placeholder="Select a backup file" name="backupFile" ng-model="backupFile" ng-file-select> <input type="file" class="form-control" placeholder="Select a backup file" name="backupFile" ng-model="backupFile" ng-file-select>
<label for="password">Password <small>Required</small></label>
<input type="password" class="form-control" placeholder="Your wallet password" name="password" ng-model="password" required>
<a class="expand small" ng-click="hideAdv=!hideAdv">
<span ng-hide="!hideAdv">Show</span>
<span ng-hide="hideAdv">Hide</span>
advanced options
</a>
<div ng-hide="hideAdv">
<label>
<input type="checkbox" class="form-control" name="skipPublicKeyRing" ng-model="skipPublicKeyRing"> Skip public keys from peers
</label>
<label>
<input type="checkbox" class="form-control" name="skipTxProposals" ng-model="skipTxProposals"> Skip transaction proposals from Backup
</label>
<label>
<input type="checkbox" class="form-control" name="skipPrivateKey" ng-model="skipPrivateKey"> Skip private key
</label>
</div>
</fieldset> </fieldset>
<label for="password">Password <small>Required</small></label>
<input type="password" class="form-control" placeholder="Your wallet password" name="password" ng-model="password" required>
<div data-alert ng-show="skipFields"> <div data-alert ng-show="skipFields">
<i class="size-18 fi-alert"></i> <i class="size-18 fi-alert"></i>
Skipping fields: {{skipFields}} Skipping fields: {{skipFields}}

View File

@ -18,7 +18,7 @@
</div> </div>
</div> </div>
<p> <p>
<a class="expand" ng-click="hideAdv=!hideAdv"> <a class="expand small" ng-click="hideAdv=!hideAdv">
<span ng-hide="!hideAdv">Show</span> <span ng-hide="!hideAdv">Show</span>
<span ng-hide="hideAdv">Hide</span> <span ng-hide="hideAdv">Hide</span>
advanced options advanced options