mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-24 12:06:15 +01:00
export vault event
This commit is contained in:
parent
803dec26e7
commit
84aab0cb24
@ -4,9 +4,11 @@ import {
|
|||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
import { CryptoService } from '../../abstractions/crypto.service';
|
import { CryptoService } from '../../abstractions/crypto.service';
|
||||||
|
import { EventService } from '../../abstractions/event.service';
|
||||||
import { ExportService } from '../../abstractions/export.service';
|
import { ExportService } from '../../abstractions/export.service';
|
||||||
import { I18nService } from '../../abstractions/i18n.service';
|
import { I18nService } from '../../abstractions/i18n.service';
|
||||||
import { PlatformUtilsService } from '../../abstractions/platformUtils.service';
|
import { PlatformUtilsService } from '../../abstractions/platformUtils.service';
|
||||||
|
import { EventType } from '../../enums/eventType';
|
||||||
|
|
||||||
export class ExportComponent {
|
export class ExportComponent {
|
||||||
@Output() onSaved = new EventEmitter();
|
@Output() onSaved = new EventEmitter();
|
||||||
@ -18,7 +20,7 @@ export class ExportComponent {
|
|||||||
|
|
||||||
constructor(protected cryptoService: CryptoService, protected i18nService: I18nService,
|
constructor(protected cryptoService: CryptoService, protected i18nService: I18nService,
|
||||||
protected platformUtilsService: PlatformUtilsService, protected exportService: ExportService,
|
protected platformUtilsService: PlatformUtilsService, protected exportService: ExportService,
|
||||||
protected win: Window) { }
|
protected eventService: EventService, protected win: Window) { }
|
||||||
|
|
||||||
async submit() {
|
async submit() {
|
||||||
if (this.masterPassword == null || this.masterPassword === '') {
|
if (this.masterPassword == null || this.masterPassword === '') {
|
||||||
@ -36,6 +38,7 @@ export class ExportComponent {
|
|||||||
this.platformUtilsService.eventTrack('Exported Data');
|
this.platformUtilsService.eventTrack('Exported Data');
|
||||||
this.downloadFile(data);
|
this.downloadFile(data);
|
||||||
this.saved();
|
this.saved();
|
||||||
|
await this.collectEvent();
|
||||||
} catch { }
|
} catch { }
|
||||||
} else {
|
} else {
|
||||||
this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'),
|
this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'),
|
||||||
@ -61,6 +64,10 @@ export class ExportComponent {
|
|||||||
return this.exportService.getFileName(prefix, this.format);
|
return this.exportService.getFileName(prefix, this.format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected async collectEvent(): Promise<any> {
|
||||||
|
await this.eventService.collect(EventType.User_ClientExportedVault);
|
||||||
|
}
|
||||||
|
|
||||||
private downloadFile(csv: string): void {
|
private downloadFile(csv: string): void {
|
||||||
const fileName = this.getFileName();
|
const fileName = this.getFileName();
|
||||||
this.platformUtilsService.saveFile(this.win, csv, { type: 'text/plain' }, fileName);
|
this.platformUtilsService.saveFile(this.win, csv, { type: 'text/plain' }, fileName);
|
||||||
|
@ -40,4 +40,5 @@ export enum EventType {
|
|||||||
|
|
||||||
Organization_Updated = 1600,
|
Organization_Updated = 1600,
|
||||||
Organization_PurgedVault = 1601,
|
Organization_PurgedVault = 1601,
|
||||||
|
Organization_ClientExportedVault = 1602,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user