1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-01-08 19:18:02 +01:00

[PM-15047] Updating admin console 3 dots menu to use th enewer attachments modal (#12402)

* Updating admin console 3 dots menu to use th enewer attachments modal

* Update apps/web/src/app/vault/org-vault/vault.component.ts

Co-authored-by: Shane Melton <smelton@bitwarden.com>

* lint fix

---------

Co-authored-by: --global <>
Co-authored-by: Shane Melton <smelton@bitwarden.com>
This commit is contained in:
cd-bitwarden 2024-12-20 14:42:15 -05:00 committed by GitHub
parent 64166a9354
commit 4b42092c93
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -104,6 +104,10 @@ 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 {
AttachmentDialogResult,
AttachmentsV2Component,
} from "../individual-vault/attachments-v2.component";
import {
BulkDeleteDialogResult,
openBulkDeleteDialog,
@ -119,7 +123,6 @@ import { VaultHeaderComponent } from "../org-vault/vault-header/vault-header.com
import { getNestedCollectionTree } from "../utils/collection-utils";
import { AddEditComponent } from "./add-edit.component";
import { AttachmentsComponent } from "./attachments.component";
import {
BulkCollectionsDialogComponent,
BulkCollectionsDialogResult,
@ -761,29 +764,18 @@ export class VaultComponent implements OnInit, OnDestroy {
return;
}
let madeAttachmentChanges = false;
const [modal] = await this.modalService.openViewRef(
AttachmentsComponent,
this.attachmentsModalRef,
(comp) => {
comp.organization = this.organization;
comp.cipherId = cipher.id;
comp.onUploadedAttachment
.pipe(takeUntil(this.destroy$))
.subscribe(() => (madeAttachmentChanges = true));
comp.onDeletedAttachment
.pipe(takeUntil(this.destroy$))
.subscribe(() => (madeAttachmentChanges = true));
},
);
modal.onClosed.pipe(takeUntil(this.destroy$)).subscribe(() => {
if (madeAttachmentChanges) {
this.refresh();
}
madeAttachmentChanges = false;
const dialogRef = AttachmentsV2Component.open(this.dialogService, {
cipherId: cipher.id as CipherId,
});
const result = await firstValueFrom(dialogRef.closed);
if (
result.action === AttachmentDialogResult.Removed ||
result.action === AttachmentDialogResult.Uploaded
) {
this.refresh();
}
}
async addCipher(cipherType?: CipherType) {