event logging on view page

This commit is contained in:
Kyle Spearrin 2019-07-09 13:11:10 -04:00
parent f3da16b230
commit 7dd11511c6
5 changed files with 15 additions and 5 deletions

2
jslib

@ -1 +1 @@
Subproject commit 74c30198587e1c799dfa16c2eb2771ff12c2eebe
Subproject commit 7bdca0dcb4bbe8983157d555740db5ed229d5948

View File

@ -33,6 +33,7 @@ import { AuthService } from 'jslib/abstractions/auth.service';
import { CipherService } from 'jslib/abstractions/cipher.service';
import { CollectionService } from 'jslib/abstractions/collection.service';
import { CryptoService } from 'jslib/abstractions/crypto.service';
import { EventService } from 'jslib/abstractions/event.service';
import { FolderService } from 'jslib/abstractions/folder.service';
import { I18nService } from 'jslib/abstractions/i18n.service';
import { LockService } from 'jslib/abstractions/lock.service';
@ -94,7 +95,7 @@ export class AppComponent implements OnInit {
private messagingService: MessagingService, private collectionService: CollectionService,
private searchService: SearchService, private notificationsService: NotificationsService,
private platformUtilsService: PlatformUtilsService, private systemService: SystemService,
private stateService: StateService) { }
private stateService: StateService, private eventService: EventService) { }
ngOnInit() {
this.ngZone.runOutsideAngular(() => {
@ -209,9 +210,11 @@ export class AppComponent implements OnInit {
}
private async logOut(expired: boolean) {
await this.eventService.uploadEvents();
const userId = await this.userService.getUserId();
await Promise.all([
this.eventService.clearEvents(),
this.syncService.setLastSync(new Date(0)),
this.tokenService.clearToken(),
this.cryptoService.clearKeys(),

View File

@ -33,6 +33,7 @@ import { ConstantsService } from 'jslib/services/constants.service';
import { ContainerService } from 'jslib/services/container.service';
import { CryptoService } from 'jslib/services/crypto.service';
import { EnvironmentService } from 'jslib/services/environment.service';
import { EventService } from 'jslib/services/event.service';
import { ExportService } from 'jslib/services/export.service';
import { FolderService } from 'jslib/services/folder.service';
import { LockService } from 'jslib/services/lock.service';
@ -57,6 +58,7 @@ import { CollectionService as CollectionServiceAbstraction } from 'jslib/abstrac
import { CryptoService as CryptoServiceAbstraction } from 'jslib/abstractions/crypto.service';
import { CryptoFunctionService as CryptoFunctionServiceAbstraction } from 'jslib/abstractions/cryptoFunction.service';
import { EnvironmentService as EnvironmentServiceAbstraction } from 'jslib/abstractions/environment.service';
import { EventService as EventServiceAbstraction } from 'jslib/abstractions/event.service';
import { ExportService as ExportServiceAbstraction } from 'jslib/abstractions/export.service';
import { FolderService as FolderServiceAbstraction } from 'jslib/abstractions/folder.service';
import { I18nService as I18nServiceAbstraction } from 'jslib/abstractions/i18n.service';
@ -117,6 +119,7 @@ const auditService = new AuditService(cryptoFunctionService, apiService);
const notificationsService = new NotificationsService(userService, syncService, appIdService,
apiService, lockService, async () => messagingService.send('logout', { expired: true }));
const environmentService = new EnvironmentService(apiService, storageService, notificationsService);
const eventService = new EventService(storageService, apiService, userService, cipherService);
const systemService = new SystemService(storageService, lockService, messagingService, platformUtilsService, null);
const analytics = new Analytics(window, () => isDev(), platformUtilsService, storageService, appIdService);
@ -129,6 +132,7 @@ export function initFactory(): Function {
lockService.init(true);
const locale = await storageService.get<string>(ConstantsService.localeKey);
await i18nService.init(locale);
eventService.init(true);
authService.init();
setTimeout(() => notificationsService.init(environmentService), 3000);
const htmlEl = window.document.documentElement;
@ -195,6 +199,7 @@ export function initFactory(): Function {
{ provide: SearchServiceAbstraction, useValue: searchService },
{ provide: NotificationsServiceAbstraction, useValue: notificationsService },
{ provide: SystemServiceAbstraction, useValue: systemService },
{ provide: EventServiceAbstraction, useValue: eventService },
{
provide: APP_INITIALIZER,
useFactory: initFactory,

View File

@ -224,7 +224,8 @@
</a>
<a class="row-btn" href="#" appStopClick appA11yTitle="{{'copyValue' | i18n}}"
*ngIf="field.value && field.type !== fieldType.Boolean"
(click)="copy(field.value, 'value', 'Field')" role="button">
(click)="copy(field.value, 'value', field.type === fieldType.Hidden ? 'H_Field' : 'Field')"
role="button">
<i class="fa fa-lg fa-clipboard" aria-hidden="true"></i>
</a>
</div>

View File

@ -10,6 +10,7 @@ import {
import { AuditService } from 'jslib/abstractions/audit.service';
import { CipherService } from 'jslib/abstractions/cipher.service';
import { CryptoService } from 'jslib/abstractions/crypto.service';
import { EventService } from 'jslib/abstractions/event.service';
import { I18nService } from 'jslib/abstractions/i18n.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { TokenService } from 'jslib/abstractions/token.service';
@ -34,9 +35,9 @@ export class ViewComponent extends BaseViewComponent implements OnChanges {
cryptoService: CryptoService, platformUtilsService: PlatformUtilsService,
auditService: AuditService, broadcasterService: BroadcasterService,
ngZone: NgZone, changeDetectorRef: ChangeDetectorRef,
userService: UserService) {
userService: UserService, eventService: EventService) {
super(cipherService, totpService, tokenService, i18nService, cryptoService, platformUtilsService,
auditService, window, broadcasterService, ngZone, changeDetectorRef, userService);
auditService, window, broadcasterService, ngZone, changeDetectorRef, userService, eventService);
}
async ngOnChanges() {