mirror of
https://github.com/bitwarden/browser
synced 2025-12-21 10:43:35 +00:00
move component code out to jslib
This commit is contained in:
@@ -3,40 +3,24 @@ import * as template from './password-generator-history.component.html';
|
||||
import { ToasterService } from 'angular2-toaster';
|
||||
import { Angulartics2 } from 'angulartics2';
|
||||
|
||||
import {
|
||||
Component,
|
||||
OnInit,
|
||||
} from '@angular/core';
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
import { I18nService } from 'jslib/abstractions/i18n.service';
|
||||
import { PasswordGenerationService } from 'jslib/abstractions/passwordGeneration.service';
|
||||
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
||||
|
||||
import { PasswordHistory } from 'jslib/models/domain/passwordHistory';
|
||||
import {
|
||||
PasswordGeneratorHistoryComponent as BasePasswordGeneratorHistoryComponent
|
||||
} from 'jslib/angular/components/password-generator-history.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-password-generator-history',
|
||||
template: template,
|
||||
})
|
||||
export class PasswordGeneratorHistoryComponent implements OnInit {
|
||||
history: PasswordHistory[] = [];
|
||||
|
||||
constructor(private passwordGenerationService: PasswordGenerationService, private analytics: Angulartics2,
|
||||
private platformUtilsService: PlatformUtilsService, private i18nService: I18nService,
|
||||
private toasterService: ToasterService) { }
|
||||
|
||||
async ngOnInit() {
|
||||
this.history = await this.passwordGenerationService.getHistory();
|
||||
}
|
||||
|
||||
clear() {
|
||||
this.history = [];
|
||||
this.passwordGenerationService.clear();
|
||||
}
|
||||
|
||||
copy(password: string) {
|
||||
this.analytics.eventTrack.next({ action: 'Copied Historical Password' });
|
||||
this.platformUtilsService.copyToClipboard(password);
|
||||
this.toasterService.popAsync('info', null, this.i18nService.t('valueCopied', this.i18nService.t('password')));
|
||||
export class PasswordGeneratorHistoryComponent extends BasePasswordGeneratorHistoryComponent {
|
||||
constructor(passwordGenerationService: PasswordGenerationService, analytics: Angulartics2,
|
||||
platformUtilsService: PlatformUtilsService, i18nService: I18nService,
|
||||
toasterService: ToasterService) {
|
||||
super(passwordGenerationService, analytics, platformUtilsService, i18nService, toasterService);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user