Added import processing message.

This commit is contained in:
Kyle Spearrin 2015-12-29 21:47:07 -05:00
parent 0c32e890b3
commit 2bc5d92c78
2 changed files with 13 additions and 14 deletions

View File

@ -5,6 +5,7 @@
$scope.model = { source: 'local' }; $scope.model = { source: 'local' };
$scope.import = function (model) { $scope.import = function (model) {
$scope.processing = true;
var file = document.getElementById('file').files[0]; var file = document.getElementById('file').files[0];
// local // local
@ -77,7 +78,7 @@
}; };
function doImport(folders, sites, siteRelationships) { function doImport(folders, sites, siteRelationships) {
$scope.importPromise = apiService.accounts.import({ apiService.accounts.import({
folders: cipherService.encryptFolders(folders, cryptoService.getKey()), folders: cipherService.encryptFolders(folders, cryptoService.getKey()),
sites: cipherService.encryptSites(sites, cryptoService.getKey()), sites: cipherService.encryptSites(sites, cryptoService.getKey()),
siteRelationships: siteRelationships siteRelationships: siteRelationships
@ -88,8 +89,8 @@
}); });
}, function () { }, function () {
$uibModalInstance.dismiss('cancel'); $uibModalInstance.dismiss('cancel');
toastr.error('Something went wrong.', 'Oh No!'); toastr.error('Something went wrong. Try again.', 'Oh No!');
}).$promise; });
} }
$scope.close = function () { $scope.close = function () {

View File

@ -2,17 +2,11 @@
<button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">&times;</span></button> <button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="importModelLabel"><i class="fa fa-cloud-upload"></i> Import</h4> <h4 class="modal-title" id="importModelLabel"><i class="fa fa-cloud-upload"></i> Import</h4>
</div> </div>
<form name="importForm" ng-submit="importForm.$valid && import(model)" api-form="importPromise"> <form name="importForm" ng-submit="importForm.$valid && import(model)" ng-show="!processing">
<div class="modal-body"> <div class="modal-body">
<div class="callout callout-danger validation-errors" ng-show="importForm.$errors"> <div class="form-group">
<h4>Errors have occured</h4>
<ul>
<li ng-repeat="e in importForm.$errors">{{e}}</li>
</ul>
</div>
<div class="form-group" show-errors>
<label for="source">Source</label> <label for="source">Source</label>
<select id="source" name="source" ng-model="model.source" class="form-control"> <select id="source" name="source" class="form-control" ng-model="model.source">
<option value="local">bitwarden</option> <option value="local">bitwarden</option>
<option value="lastpass">LastPass</option> <option value="lastpass">LastPass</option>
</select> </select>
@ -23,9 +17,13 @@
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="submit" class="btn btn-primary btn-flat" ng-disabled="importForm.$loading"> <button type="submit" class="btn btn-primary btn-flat">
<i class="fa fa-refresh fa-spin loading-icon" ng-show="importForm.$loading"></i> Import Import
</button> </button>
<button type="button" class="btn btn-default btn-flat" ng-click="close()">Close</button> <button type="button" class="btn btn-default btn-flat" ng-click="close()">Close</button>
</div> </div>
</form> </form>
<div ng-show="processing" class="modal-body text-center">
<p><i class="fa fa-cog fa-spin fa-3x"></i></p>
<p>Please wait. We are now importing all of your data. Do not close this window. You will be redirected to your vault when the import has completed.</p>
</div>