1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 00:03:56 +00:00
Files
browser/src/popup/app/tools/password-generator-history.component.ts
2018-01-11 14:34:53 -05:00

57 lines
1.6 KiB
TypeScript

import * as template from './password-generator-history.component.html';
import { PasswordHistory } from 'jslib/models/domain/passwordHistory';
import { PasswordGenerationService } from 'jslib/abstractions/passwordGeneration.service';
export class PasswordGeneratorHistoryController {
$transition$: any;
history: PasswordHistory[];
editState: any;
addState: any;
i18n: any;
constructor(private $state: any, private passwordGenerationService: PasswordGenerationService,
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: template,
};