From e65e3353501a12be2fea46b7135c7a7ce5b71490 Mon Sep 17 00:00:00 2001 From: binsky Date: Wed, 24 Mar 2021 18:28:57 +0100 Subject: add reload button; auto reload vault after import --- js/app/controllers/credential.js | 5 +++++ js/app/controllers/import.js | 15 ++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) (limited to 'js/app') diff --git a/js/app/controllers/credential.js b/js/app/controllers/credential.js index 9d84f33c..21121cf3 100644 --- a/js/app/controllers/credential.js +++ b/js/app/controllers/credential.js @@ -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) { diff --git a/js/app/controllers/import.js b/js/app/controllers/import.js index 7014e9ea..0fc9dbea 100644 --- a/js/app/controllers/import.js +++ b/js/app/controllers/import.js @@ -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(); - }); - } } }; -- cgit v1.2.3