diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json
index 6d2e028f9c..58c26081a1 100644
--- a/src/_locales/en/messages.json
+++ b/src/_locales/en/messages.json
@@ -974,5 +974,8 @@
},
"identities": {
"message": "Identities"
+ },
+ "clear": {
+ "message": "Clear"
}
}
diff --git a/src/popup/app/app.js b/src/popup/app/app.js
index bbb355022b..5c203a41f3 100644
--- a/src/popup/app/app.js
+++ b/src/popup/app/app.js
@@ -108,7 +108,6 @@ require('./vault/vaultAddCipherController.js');
require('./vault/vaultEditCipherController.js');
require('./vault/vaultViewCipherController.js');
require('./vault/vaultAttachmentsController.js');
-require('./tools/toolsPasswordGeneratorHistoryController.js');
// $$ngIsClass fix issue with "class constructors must be invoked with |new|" on Firefox ESR
// ref: https://github.com/angular/angular.js/issues/14240
@@ -128,6 +127,8 @@ import { ExportController } from './tools/export.component';
ExportController.$$ngIsClass = true;
import { PasswordGeneratorController } from './tools/password-generator.component';
PasswordGeneratorController.$$ngIsClass = true;
+import { PasswordGeneratorHistoryController } from './tools/password-generator-history.component';
+PasswordGeneratorHistoryController.$$ngIsClass = true;
import { ToolsController } from './tools/tools.component';
ToolsController.$$ngIsClass = true;
import { AddFolderController } from './settings/folders/add-folder.component';
diff --git a/src/popup/app/config.js b/src/popup/app/config.js
index 50cfb4e907..8995d4cc9f 100644
--- a/src/popup/app/config.js
+++ b/src/popup/app/config.js
@@ -170,9 +170,8 @@ angular
params: { animation: null, addState: null, editState: null }
})
.state('passwordGeneratorHistory', {
- url: '/history',
- template: require('./tools/views/toolsPasswordGeneratorHistory.html'),
- controller: 'toolsPasswordGeneratorHistoryController',
+ url: '/password-generator-history',
+ component: 'passwordGeneratorHistory',
data: { authorize: true },
params: { animation: null, addState: null, editState: null }
})
diff --git a/src/popup/app/tools/password-generator-history.component.html b/src/popup/app/tools/password-generator-history.component.html
new file mode 100644
index 0000000000..54f5411740
--- /dev/null
+++ b/src/popup/app/tools/password-generator-history.component.html
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+ {{item.password}}
+
+
{{item.date | date: 'medium'}}
+
+
+
+
diff --git a/src/popup/app/tools/password-generator-history.component.ts b/src/popup/app/tools/password-generator-history.component.ts
new file mode 100644
index 0000000000..f99c2b39ec
--- /dev/null
+++ b/src/popup/app/tools/password-generator-history.component.ts
@@ -0,0 +1,54 @@
+import * as template from './password-generator-history.component.html';
+
+import PasswordHistory from '../../../models/domain/passwordHistory';
+
+export class PasswordGeneratorHistoryController {
+ $transition$: any;
+ history: PasswordHistory[];
+ editState: any;
+ addState: any;
+ i18n: any;
+
+ constructor(private $state: any, private passwordGenerationService: any, private toastr: any,
+ private $analytics: any, private i18nService: any) {
+ this.i18n = i18nService;
+ this.history = passwordGenerationService.getHistory();
+ }
+
+ $onInit() {
+ const params = this.$transition$.params('to');
+ this.addState = params.addState;
+ this.editState = params.editState;
+ }
+
+ clear() {
+ this.history = [];
+ this.passwordGenerationService.clear();
+ }
+
+ clipboardError(e: any, password: any) {
+ this.toastr.info(this.i18nService.browserNotSupportClipboard);
+ }
+
+ clipboardSuccess(e: any) {
+ this.$analytics.eventTrack('Copied Historical Password');
+ e.clearSelection();
+ this.toastr.info(this.i18nService.passwordCopied);
+ }
+
+ close() {
+ this.$state.go('^.passwordGenerator', {
+ animation: 'out-slide-right',
+ addState: this.addState,
+ editState: this.editState,
+ });
+ }
+}
+
+export const PasswordGeneratorHistoryComponent = {
+ bindings: {
+ $transition$: '<',
+ },
+ controller: PasswordGeneratorHistoryController,
+ template,
+};
diff --git a/src/popup/app/tools/tools.module.ts b/src/popup/app/tools/tools.module.ts
index 3c9b564a31..49821bbb73 100644
--- a/src/popup/app/tools/tools.module.ts
+++ b/src/popup/app/tools/tools.module.ts
@@ -1,5 +1,6 @@
import * as angular from 'angular';
import { ExportComponent } from './export.component';
+import { PasswordGeneratorHistoryComponent } from './password-generator-history.component';
import { PasswordGeneratorComponent } from './password-generator.component';
import { ToolsComponent } from './tools.component';
@@ -7,6 +8,7 @@ export default angular
.module('bit.tools', ['ngAnimate', 'ngclipboard', 'toastr', 'oitozero.ngSweetAlert'])
.component('tools', ToolsComponent)
+ .component('passwordGeneratorHistory', PasswordGeneratorHistoryComponent)
.component('passwordGenerator', PasswordGeneratorComponent)
.component('export', ExportComponent)
diff --git a/src/popup/app/tools/toolsPasswordGeneratorHistoryController.js b/src/popup/app/tools/toolsPasswordGeneratorHistoryController.js
deleted file mode 100644
index fa0c258571..0000000000
--- a/src/popup/app/tools/toolsPasswordGeneratorHistoryController.js
+++ /dev/null
@@ -1,30 +0,0 @@
-angular
- .module('bit.tools')
-
- .controller('toolsPasswordGeneratorHistoryController', function ($scope, $state, $stateParams, toastr, $analytics,
- i18nService, passwordGenerationService) {
- $scope.i18n = i18nService;
- $scope.passwords = passwordGenerationService.getHistory();
-
- $scope.clipboardError = function (e, password) {
- toastr.info(i18n.browserNotSupportClipboard);
- };
-
- $scope.clipboardSuccess = function (e) {
- $analytics.eventTrack('Copied Generated Password');
- e.clearSelection();
- toastr.info(i18nService.passwordCopied);
- };
-
- $scope.close = function () {
- dismiss();
- };
-
- function dismiss() {
- $state.go('^.passwordGenerator', {
- animation: 'out-slide-right',
- addState: $stateParams.addState,
- editState: $stateParams.editState
- });
- }
- });
diff --git a/src/popup/app/tools/views/toolsPasswordGeneratorHistory.html b/src/popup/app/tools/views/toolsPasswordGeneratorHistory.html
deleted file mode 100644
index d08630bd40..0000000000
--- a/src/popup/app/tools/views/toolsPasswordGeneratorHistory.html
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
- {{password.password}}
-
-
{{password.date | date: 'medium'}}
-
-
-
-
diff --git a/src/services/passwordGeneration.service.ts b/src/services/passwordGeneration.service.ts
index 93be7c9f73..f7a71ff45d 100644
--- a/src/services/passwordGeneration.service.ts
+++ b/src/services/passwordGeneration.service.ts
@@ -205,7 +205,7 @@ export default class PasswordGenerationService {
if (this.history == null || this.history.length === 0) {
return Promise.resolve([]);
}
-
+
const promises = this.history.map(async (item) => {
const encrypted = await this.cryptoService.encrypt(item.password);
return new PasswordHistory(encrypted.encryptedString, item.date);