1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-26 17:08:33 +01:00

event log from copy on listing

This commit is contained in:
Kyle Spearrin 2019-07-12 15:34:27 -04:00
parent 1aacd4ece1
commit 3a2f04006f
3 changed files with 16 additions and 5 deletions

View File

@ -9,6 +9,7 @@ import { Angulartics2 } from 'angulartics2';
import { ApiService } from 'jslib/abstractions/api.service';
import { CipherService } from 'jslib/abstractions/cipher.service';
import { EventService } from 'jslib/abstractions/event.service';
import { I18nService } from 'jslib/abstractions/i18n.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { SearchService } from 'jslib/abstractions/search.service';
@ -33,8 +34,9 @@ export class CiphersComponent extends BaseCiphersComponent {
constructor(searchService: SearchService, analytics: Angulartics2,
toasterService: ToasterService, i18nService: I18nService,
platformUtilsService: PlatformUtilsService, cipherService: CipherService,
private apiService: ApiService) {
super(searchService, analytics, toasterService, i18nService, platformUtilsService, cipherService);
private apiService: ApiService, eventService: EventService) {
super(searchService, analytics, toasterService, i18nService, platformUtilsService,
cipherService, eventService);
}
async load(filter: (cipher: CipherView) => boolean = null) {

View File

@ -31,7 +31,7 @@
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuButton">
<ng-container *ngIf="c.type === cipherType.Login">
<a class="dropdown-item" href="#" appStopClick
(click)="copy(c.login.password, 'password', 'password')">
(click)="copy(c, c.login.password, 'password', 'password')">
<i class="fa fa-fw fa-clipboard"></i>
{{'copyPassword' | i18n}}
</a>

View File

@ -10,6 +10,7 @@ import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { CipherService } from 'jslib/abstractions/cipher.service';
import { EventService } from 'jslib/abstractions/event.service';
import { I18nService } from 'jslib/abstractions/i18n.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { SearchService } from 'jslib/abstractions/search.service';
@ -17,6 +18,7 @@ import { SearchService } from 'jslib/abstractions/search.service';
import { CiphersComponent as BaseCiphersComponent } from 'jslib/angular/components/ciphers.component';
import { CipherType } from 'jslib/enums/cipherType';
import { EventType } from 'jslib/enums/eventType';
import { CipherView } from 'jslib/models/view/cipherView';
@ -37,7 +39,8 @@ export class CiphersComponent extends BaseCiphersComponent implements OnDestroy
constructor(searchService: SearchService, protected analytics: Angulartics2,
protected toasterService: ToasterService, protected i18nService: I18nService,
protected platformUtilsService: PlatformUtilsService, protected cipherService: CipherService) {
protected platformUtilsService: PlatformUtilsService, protected cipherService: CipherService,
protected eventService: EventService) {
super(searchService);
this.pageSize = 200;
}
@ -109,7 +112,7 @@ export class CiphersComponent extends BaseCiphersComponent implements OnDestroy
this.actionPromise = null;
}
copy(value: string, typeI18nKey: string, aType: string) {
copy(cipher: CipherView, value: string, typeI18nKey: string, aType: string) {
if (value == null) {
return;
}
@ -118,6 +121,12 @@ export class CiphersComponent extends BaseCiphersComponent implements OnDestroy
this.platformUtilsService.copyToClipboard(value, { window: window });
this.toasterService.popAsync('info', null,
this.i18nService.t('valueCopied', this.i18nService.t(typeI18nKey)));
if (typeI18nKey === 'password') {
this.eventService.collect(EventType.Cipher_ClientToggledHiddenFieldVisible, cipher.id);
} else if (typeI18nKey === 'securityCode') {
this.eventService.collect(EventType.Cipher_ClientCopiedCardCode, cipher.id);
}
}
protected deleteCipher(id: string) {