add reload button; auto reload vault after import

This commit is contained in:
binsky 2021-03-24 18:28:57 +01:00
parent 3cbb2dcda1
commit e65e335350
5 changed files with 17 additions and 12 deletions

View file

@ -50,6 +50,11 @@
}
}
$rootScope.refresh = function () {
fetchCredentials();
getPendingShareRequests();
};
$scope.show_spinner = true;
var fetchCredentials = function () {
VaultService.getVault({guid: $routeParams.vault_id}).then(function (vault) {

View file

@ -31,7 +31,7 @@
* Controller of the passmanApp
*/
angular.module('passmanApp')
.controller('ImportCtrl', ['$scope', '$window', 'CredentialService', 'VaultService', 'FileService', 'EncryptService', '$translate', function ($scope, $window, CredentialService, VaultService, FileService, EncryptService, $translate) {
.controller('ImportCtrl', ['$scope', '$rootScope', '$window', 'CredentialService', 'VaultService', 'FileService', 'EncryptService', '$translate', function ($scope, $rootScope, $window, CredentialService, VaultService, FileService, EncryptService, $translate) {
$scope.available_importers = [];
$scope.active_vault = VaultService.getActiveVault();
@ -109,6 +109,7 @@
total: parsed_data.length
};
_log($translate.instant('done'));
$rootScope.refresh();
}
}
});
@ -130,7 +131,7 @@
process.setRequiredServices(FileService, EncryptService);
}
process = process.readFile(file_data).then(function (parseddata) {
process.readFile(file_data).then(function (parseddata) {
parsed_data = parseddata;
$scope.file_read_progress = {
percent: 100,
@ -144,14 +145,10 @@
} else {
// @TODO Show message no data found
}
}).progress(function (progress) {
$scope.file_read_progress = progress;
$scope.$digest();
});
if ($scope.selectedImporter.id !== 'passmanJson'){
process.progress(function (progress) {
$scope.file_read_progress = progress;
$scope.$digest();
});
}
}
};

View file

@ -41,7 +41,7 @@ var PassmanImporter = PassmanImporter || {};
EncryptService = EncryptSvc;
};
PassmanImporter.passmanJson.readFile = async function (file_data) {
PassmanImporter.passmanJson.readFile = function (file_data) {
/** global: C_Promise */
return new C_Promise(async function(){
var parseCustomFields = async function (customFields, credential){

File diff suppressed because one or more lines are too long

View file

@ -11,8 +11,11 @@
</div>
<div class="addCredential" ng-hide="delete_time>0">
<button ng-click="addCredential()">+</button>
<button ng-click="addCredential()"><i class="fa fa-plus"></i></button>
</div>
<div class="addCredential" ng-hide="delete_time>0">
<button ng-click="refresh()"><i class="fa fa-refresh"></i></button>
</div>
</div>
<div class="title" credential-counter="filtered_credentials" vault="active_vault" delete-time="delete_time" filters="filterOptions"></div>