From e0ff3641090a962ca46d541b31ab4abc27792495 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 25 Jul 2019 12:22:36 -0400 Subject: [PATCH] use setComponentParameters callback --- jslib | 2 +- src/app/vault/vault.component.ts | 28 +++++++++++----------------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/jslib b/jslib index 4bf44fa5..ff13cb28 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit 4bf44fa5b88f33f3a34492292dd02e00a588009e +Subproject commit ff13cb283896c68128fccf28ae65b89c090be522 diff --git a/src/app/vault/vault.component.ts b/src/app/vault/vault.component.ts index a6944be2..e0905ee3 100644 --- a/src/app/vault/vault.component.ts +++ b/src/app/vault/vault.component.ts @@ -365,9 +365,8 @@ export class VaultComponent implements OnInit, OnDestroy { const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); this.modal = this.attachmentsModalRef.createComponent(factory).instance; - const childComponent = this.modal.show(AttachmentsComponent, this.attachmentsModalRef); - - childComponent.cipherId = cipher.id; + const childComponent = this.modal.show(AttachmentsComponent, this.attachmentsModalRef, + true, (comp) => comp.cipherId = cipher.id); let madeAttachmentChanges = false; childComponent.onUploadedAttachment.subscribe(() => madeAttachmentChanges = true); childComponent.onDeletedAttachment.subscribe(() => madeAttachmentChanges = true); @@ -388,8 +387,8 @@ export class VaultComponent implements OnInit, OnDestroy { const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); this.modal = this.shareModalRef.createComponent(factory).instance; - const childComponent = this.modal.show(ShareComponent, this.shareModalRef); - childComponent.cipherId = cipher.id; + const childComponent = this.modal.show(ShareComponent, this.shareModalRef, true, + (comp) => comp.cipherId = cipher.id); childComponent.onSharedCipher.subscribe(async () => { this.modal.close(); @@ -408,8 +407,8 @@ export class VaultComponent implements OnInit, OnDestroy { const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); this.modal = this.collectionsModalRef.createComponent(factory).instance; - const childComponent = this.modal.show(CollectionsComponent, this.collectionsModalRef); - childComponent.cipherId = cipher.id; + const childComponent = this.modal.show(CollectionsComponent, this.collectionsModalRef, + true, (comp) => comp.cipherId = cipher.id); childComponent.onSavedCollections.subscribe(() => { this.modal.close(); @@ -427,10 +426,8 @@ export class VaultComponent implements OnInit, OnDestroy { const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); this.modal = this.passwordHistoryModalRef.createComponent(factory).instance; - const childComponent = this.modal.show(PasswordHistoryComponent, - this.passwordHistoryModalRef); - - childComponent.cipherId = cipher.id; + this.modal.show(PasswordHistoryComponent, + this.passwordHistoryModalRef, true, (comp) => comp.cipherId = cipher.id); this.modal.onClosed.subscribe(async () => { this.modal = null; }); @@ -492,9 +489,8 @@ export class VaultComponent implements OnInit, OnDestroy { const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); this.modal = this.passwordGeneratorModalRef.createComponent(factory).instance; const childComponent = this.modal.show(PasswordGeneratorComponent, - this.passwordGeneratorModalRef); + this.passwordGeneratorModalRef, true, (comp) => comp.showSelect = showSelect); - childComponent.showSelect = showSelect; childComponent.onSelected.subscribe((password: string) => { this.modal.close(); if (this.addEditComponent != null && this.addEditComponent.cipher != null && @@ -534,9 +530,8 @@ export class VaultComponent implements OnInit, OnDestroy { const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); this.modal = this.folderAddEditModalRef.createComponent(factory).instance; const childComponent = this.modal.show( - FolderAddEditComponent, this.folderAddEditModalRef); + FolderAddEditComponent, this.folderAddEditModalRef, true, (comp) => comp.folderId = null); - childComponent.folderId = null; childComponent.onSavedFolder.subscribe(async (folder: FolderView) => { this.modal.close(); await this.groupingsComponent.loadFolders(); @@ -555,9 +550,8 @@ export class VaultComponent implements OnInit, OnDestroy { const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); this.modal = this.folderAddEditModalRef.createComponent(factory).instance; const childComponent = this.modal.show( - FolderAddEditComponent, this.folderAddEditModalRef); + FolderAddEditComponent, this.folderAddEditModalRef, true, (comp) => comp.folderId = folderId); - childComponent.folderId = folderId; childComponent.onSavedFolder.subscribe(async (folder: FolderView) => { this.modal.close(); await this.groupingsComponent.loadFolders();