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.import = function (model) {
$scope.processing = true;
var file = document.getElementById('file').files[0];
// local
@ -77,7 +78,7 @@
};
function doImport(folders, sites, siteRelationships) {
$scope.importPromise = apiService.accounts.import({
apiService.accounts.import({
folders: cipherService.encryptFolders(folders, cryptoService.getKey()),
sites: cipherService.encryptSites(sites, cryptoService.getKey()),
siteRelationships: siteRelationships
@ -88,8 +89,8 @@
});
}, function () {
$uibModalInstance.dismiss('cancel');
toastr.error('Something went wrong.', 'Oh No!');
}).$promise;
toastr.error('Something went wrong. Try again.', 'Oh No!');
});
}
$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>
<h4 class="modal-title" id="importModelLabel"><i class="fa fa-cloud-upload"></i> Import</h4>
</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="callout callout-danger validation-errors" ng-show="importForm.$errors">
<h4>Errors have occured</h4>
<ul>
<li ng-repeat="e in importForm.$errors">{{e}}</li>
</ul>
</div>
<div class="form-group" show-errors>
<div class="form-group">
<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="lastpass">LastPass</option>
</select>
@ -23,9 +17,13 @@
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary btn-flat" ng-disabled="importForm.$loading">
<i class="fa fa-refresh fa-spin loading-icon" ng-show="importForm.$loading"></i> Import
<button type="submit" class="btn btn-primary btn-flat">
Import
</button>
<button type="button" class="btn btn-default btn-flat" ng-click="close()">Close</button>
</div>
</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>