mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 09:13:33 +00:00
convert password history to ts. added clear option
This commit is contained in:
54
src/popup/app/tools/password-generator-history.component.ts
Normal file
54
src/popup/app/tools/password-generator-history.component.ts
Normal file
@@ -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,
|
||||
};
|
||||
Reference in New Issue
Block a user