1
0
mirror of https://github.com/bitwarden/web synced 2025-12-28 22:23:52 +00:00

generic event log component for user/ciphers

This commit is contained in:
Kyle Spearrin
2018-07-11 15:22:55 -04:00
parent 6d225beb46
commit 98d3b42728
8 changed files with 89 additions and 16 deletions

View File

@@ -22,6 +22,7 @@ import { CipherType } from 'jslib/enums/cipherType';
import { ModalComponent } from '../../modal.component';
import { EntityEventsComponent } from '../manage/entity-events.component';
import { AddEditComponent } from './add-edit.component';
import { AttachmentsComponent } from './attachments.component';
import { CiphersComponent } from './ciphers.component';
@@ -38,6 +39,7 @@ export class VaultComponent implements OnInit {
@ViewChild('attachments', { read: ViewContainerRef }) attachmentsModalRef: ViewContainerRef;
@ViewChild('cipherAddEdit', { read: ViewContainerRef }) cipherAddEditModalRef: ViewContainerRef;
@ViewChild('collections', { read: ViewContainerRef }) collectionsModalRef: ViewContainerRef;
@ViewChild('eventsTemplate', { read: ViewContainerRef }) eventsModalRef: ViewContainerRef;
organization: Organization;
collectionId: string;
@@ -210,6 +212,27 @@ export class VaultComponent implements OnInit {
return childComponent;
}
async viewEvents(cipher: CipherView) {
if (this.modal != null) {
this.modal.close();
}
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
this.modal = this.eventsModalRef.createComponent(factory).instance;
const childComponent = this.modal.show<EntityEventsComponent>(
EntityEventsComponent, this.eventsModalRef);
childComponent.name = cipher.name;
childComponent.organizationId = this.organization.id;
childComponent.entityId = cipher.id;
childComponent.showUser = true;
childComponent.entity = 'cipher';
this.modal.onClosed.subscribe(() => {
this.modal = null;
});
}
private clearFilters() {
this.collectionId = null;
this.type = null;