From 17f4fe96e404c8ac91cb509edf4e442652a55beb Mon Sep 17 00:00:00 2001 From: Nick Krantz Date: Thu, 3 Oct 2024 08:23:24 -0500 Subject: [PATCH] integrate add cipher with admin console vault --- .../app/vault/org-vault/vault.component.ts | 29 +++---------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/apps/web/src/app/vault/org-vault/vault.component.ts b/apps/web/src/app/vault/org-vault/vault.component.ts index 0567ef13ece..d8c00720985 100644 --- a/apps/web/src/app/vault/org-vault/vault.component.ts +++ b/apps/web/src/app/vault/org-vault/vault.component.ts @@ -89,12 +89,6 @@ import { } from "../components/vault-item-dialog/vault-item-dialog.component"; import { VaultItemEvent } from "../components/vault-items/vault-item-event"; import { VaultItemsModule } from "../components/vault-items/vault-items.module"; -import { - AddEditCipherDialogCloseResult, - AddEditCipherDialogResult, - AddEditComponentV2, - openAddEditCipherDialog, -} from "../individual-vault/add-edit-v2.component"; import { BulkDeleteDialogResult, openBulkDeleteDialog, @@ -139,7 +133,6 @@ enum AddAccessStatusType { VaultItemsModule, SharedModule, NoItemsModule, - AddEditComponentV2, ], providers: [ RoutedVaultFilterService, @@ -784,28 +777,14 @@ export class VaultComponent implements OnInit, OnDestroy { cipherType, ); + const collectionId: CollectionId | undefined = this.activeFilter.collectionId as CollectionId; + cipherFormConfig.initialValues = { organizationId: this.organization.id as OrganizationId, - collectionIds: this.collections.map((c) => c.id as CollectionId), + collectionIds: collectionId ? [collectionId] : [], }; - // Open the dialog. - const dialogRef = openAddEditCipherDialog(this.dialogService, { - data: cipherFormConfig, - }); - - // Wait for the dialog to close. - const result: AddEditCipherDialogCloseResult = await lastValueFrom(dialogRef.closed); - - // Refresh the vault to show the new cipher. - if (result?.action === AddEditCipherDialogResult.Added) { - this.refresh(); - this.go({ itemId: result.id, action: "view" }); - return; - } - - // If the dialog was closed by any other action navigate back to the vault. - this.go({ cipherId: null, itemId: null, action: null }); + await this.openVaultItemDialog("form", cipherFormConfig); } async editCipher(