From e65e3353501a12be2fea46b7135c7a7ce5b71490 Mon Sep 17 00:00:00 2001 From: binsky Date: Wed, 24 Mar 2021 18:28:57 +0100 Subject: [PATCH] add reload button; auto reload vault after import --- js/app/controllers/credential.js | 5 +++++ js/app/controllers/import.js | 15 ++++++--------- js/importers/importer-passmanjson.js | 2 +- js/templates.js | 2 +- templates/views/show_vault.html | 5 ++++- 5 files changed, 17 insertions(+), 12 deletions(-) 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(); - }); - } } }; diff --git a/js/importers/importer-passmanjson.js b/js/importers/importer-passmanjson.js index 7fa9dcfc..f600d0e9 100644 --- a/js/importers/importer-passmanjson.js +++ b/js/importers/importer-passmanjson.js @@ -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){ diff --git a/js/templates.js b/js/templates.js index 566b6ece..1ea17bfe 100644 --- a/js/templates.js +++ b/js/templates.js @@ -131,7 +131,7 @@ angular.module('views/share_credential.html', []).run(['$templateCache', functio angular.module('views/show_vault.html', []).run(['$templateCache', function($templateCache) { 'use strict'; $templateCache.put('views/show_vault.html', - '
{{ \'use.regex\' | translate }}
{{ ::tag.text}} {{ ::credential.label}} {{ \'compromised.warning.list\' | translate}}
  • {{ ::credential.label}}
    {{ ::tag.text}}
{{\'vault.hint.hello\' | translate}}
{{\'vault.hint.hello.add\' | translate}}
{{ \'vault.hint.list.notags\' | translate}}
{{ \'vault.hint.list.nosearch\' | translate}} \'{{filterOptions.filterText}}\'
{{ \'vault.hint.list.nogood\' | translate}}
{{ \'vault.hint.list.nomedium\' | translate}}
{{ \'vault.hint.list.nobad\' | translate}}
{{ \'vault.hint.list.noexpired\' | translate}}
{{ \'vault.hint.list.nodeleted\' | translate}}
{{ \'use.regex\' | translate }}
{{ ::tag.text}} {{ ::credential.label}} {{ \'compromised.warning.list\' | translate}}
{{\'vault.hint.hello\' | translate}}
{{\'vault.hint.hello.add\' | translate}}
{{ \'vault.hint.list.notags\' | translate}}
{{ \'vault.hint.list.nosearch\' | translate}} \'{{filterOptions.filterText}}\'
{{ \'vault.hint.list.nogood\' | translate}}
{{ \'vault.hint.list.nomedium\' | translate}}
{{ \'vault.hint.list.nobad\' | translate}}
{{ \'vault.hint.list.noexpired\' | translate}}
{{ \'vault.hint.list.nodeleted\' | translate}}
'); }]); diff --git a/templates/views/show_vault.html b/templates/views/show_vault.html index 75c97869..d4bcccb1 100644 --- a/templates/views/show_vault.html +++ b/templates/views/show_vault.html @@ -11,8 +11,11 @@
- +
+
+ +