1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 16:23:44 +00:00

use setComponentParameters callback

This commit is contained in:
Kyle Spearrin
2019-07-25 12:22:36 -04:00
parent 51aecb1e5e
commit e0ff364109
2 changed files with 12 additions and 18 deletions

2
jslib

Submodule jslib updated: 4bf44fa5b8...ff13cb2838

View File

@@ -365,9 +365,8 @@ export class VaultComponent implements OnInit, OnDestroy {
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
this.modal = this.attachmentsModalRef.createComponent(factory).instance; this.modal = this.attachmentsModalRef.createComponent(factory).instance;
const childComponent = this.modal.show<AttachmentsComponent>(AttachmentsComponent, this.attachmentsModalRef); const childComponent = this.modal.show<AttachmentsComponent>(AttachmentsComponent, this.attachmentsModalRef,
true, (comp) => comp.cipherId = cipher.id);
childComponent.cipherId = cipher.id;
let madeAttachmentChanges = false; let madeAttachmentChanges = false;
childComponent.onUploadedAttachment.subscribe(() => madeAttachmentChanges = true); childComponent.onUploadedAttachment.subscribe(() => madeAttachmentChanges = true);
childComponent.onDeletedAttachment.subscribe(() => madeAttachmentChanges = true); childComponent.onDeletedAttachment.subscribe(() => madeAttachmentChanges = true);
@@ -388,8 +387,8 @@ export class VaultComponent implements OnInit, OnDestroy {
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
this.modal = this.shareModalRef.createComponent(factory).instance; this.modal = this.shareModalRef.createComponent(factory).instance;
const childComponent = this.modal.show<ShareComponent>(ShareComponent, this.shareModalRef); const childComponent = this.modal.show<ShareComponent>(ShareComponent, this.shareModalRef, true,
childComponent.cipherId = cipher.id; (comp) => comp.cipherId = cipher.id);
childComponent.onSharedCipher.subscribe(async () => { childComponent.onSharedCipher.subscribe(async () => {
this.modal.close(); this.modal.close();
@@ -408,8 +407,8 @@ export class VaultComponent implements OnInit, OnDestroy {
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
this.modal = this.collectionsModalRef.createComponent(factory).instance; this.modal = this.collectionsModalRef.createComponent(factory).instance;
const childComponent = this.modal.show<CollectionsComponent>(CollectionsComponent, this.collectionsModalRef); const childComponent = this.modal.show<CollectionsComponent>(CollectionsComponent, this.collectionsModalRef,
childComponent.cipherId = cipher.id; true, (comp) => comp.cipherId = cipher.id);
childComponent.onSavedCollections.subscribe(() => { childComponent.onSavedCollections.subscribe(() => {
this.modal.close(); this.modal.close();
@@ -427,10 +426,8 @@ export class VaultComponent implements OnInit, OnDestroy {
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
this.modal = this.passwordHistoryModalRef.createComponent(factory).instance; this.modal = this.passwordHistoryModalRef.createComponent(factory).instance;
const childComponent = this.modal.show<PasswordHistoryComponent>(PasswordHistoryComponent, this.modal.show<PasswordHistoryComponent>(PasswordHistoryComponent,
this.passwordHistoryModalRef); this.passwordHistoryModalRef, true, (comp) => comp.cipherId = cipher.id);
childComponent.cipherId = cipher.id;
this.modal.onClosed.subscribe(async () => { this.modal.onClosed.subscribe(async () => {
this.modal = null; this.modal = null;
}); });
@@ -492,9 +489,8 @@ export class VaultComponent implements OnInit, OnDestroy {
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
this.modal = this.passwordGeneratorModalRef.createComponent(factory).instance; this.modal = this.passwordGeneratorModalRef.createComponent(factory).instance;
const childComponent = this.modal.show<PasswordGeneratorComponent>(PasswordGeneratorComponent, const childComponent = this.modal.show<PasswordGeneratorComponent>(PasswordGeneratorComponent,
this.passwordGeneratorModalRef); this.passwordGeneratorModalRef, true, (comp) => comp.showSelect = showSelect);
childComponent.showSelect = showSelect;
childComponent.onSelected.subscribe((password: string) => { childComponent.onSelected.subscribe((password: string) => {
this.modal.close(); this.modal.close();
if (this.addEditComponent != null && this.addEditComponent.cipher != null && if (this.addEditComponent != null && this.addEditComponent.cipher != null &&
@@ -534,9 +530,8 @@ export class VaultComponent implements OnInit, OnDestroy {
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
this.modal = this.folderAddEditModalRef.createComponent(factory).instance; this.modal = this.folderAddEditModalRef.createComponent(factory).instance;
const childComponent = this.modal.show<FolderAddEditComponent>( const childComponent = this.modal.show<FolderAddEditComponent>(
FolderAddEditComponent, this.folderAddEditModalRef); FolderAddEditComponent, this.folderAddEditModalRef, true, (comp) => comp.folderId = null);
childComponent.folderId = null;
childComponent.onSavedFolder.subscribe(async (folder: FolderView) => { childComponent.onSavedFolder.subscribe(async (folder: FolderView) => {
this.modal.close(); this.modal.close();
await this.groupingsComponent.loadFolders(); await this.groupingsComponent.loadFolders();
@@ -555,9 +550,8 @@ export class VaultComponent implements OnInit, OnDestroy {
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
this.modal = this.folderAddEditModalRef.createComponent(factory).instance; this.modal = this.folderAddEditModalRef.createComponent(factory).instance;
const childComponent = this.modal.show<FolderAddEditComponent>( const childComponent = this.modal.show<FolderAddEditComponent>(
FolderAddEditComponent, this.folderAddEditModalRef); FolderAddEditComponent, this.folderAddEditModalRef, true, (comp) => comp.folderId = folderId);
childComponent.folderId = folderId;
childComponent.onSavedFolder.subscribe(async (folder: FolderView) => { childComponent.onSavedFolder.subscribe(async (folder: FolderView) => {
this.modal.close(); this.modal.close();
await this.groupingsComponent.loadFolders(); await this.groupingsComponent.loadFolders();