diff --git a/apps/web/src/app/auth/settings/emergency-access/attachments/emergency-access-attachments.component.ts b/apps/web/src/app/auth/settings/emergency-access/attachments/emergency-access-attachments.component.ts deleted file mode 100644 index 73191e1539e..00000000000 --- a/apps/web/src/app/auth/settings/emergency-access/attachments/emergency-access-attachments.component.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { Component } from "@angular/core"; - -import { AttachmentsComponent as BaseAttachmentsComponent } from "@bitwarden/angular/vault/components/attachments.component"; -import { ApiService } from "@bitwarden/common/abstractions/api.service"; -import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; -import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions/account/billing-account-profile-state.service"; -import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service"; -import { FileDownloadService } from "@bitwarden/common/platform/abstractions/file-download/file-download.service"; -import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; -import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; -import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; -import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; -import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; -import { AttachmentView } from "@bitwarden/common/vault/models/view/attachment.view"; -import { DialogService, ToastService } from "@bitwarden/components"; -import { KeyService } from "@bitwarden/key-management"; - -@Component({ - selector: "emergency-access-attachments", - templateUrl: "../../../../vault/individual-vault/attachments.component.html", -}) -export class EmergencyAccessAttachmentsComponent extends BaseAttachmentsComponent { - viewOnly = true; - canAccessAttachments = true; - - constructor( - cipherService: CipherService, - i18nService: I18nService, - keyService: KeyService, - encryptService: EncryptService, - stateService: StateService, - platformUtilsService: PlatformUtilsService, - apiService: ApiService, - logService: LogService, - fileDownloadService: FileDownloadService, - dialogService: DialogService, - billingAccountProfileStateService: BillingAccountProfileStateService, - accountService: AccountService, - toastService: ToastService, - ) { - super( - cipherService, - i18nService, - keyService, - encryptService, - platformUtilsService, - apiService, - window, - logService, - stateService, - fileDownloadService, - dialogService, - billingAccountProfileStateService, - accountService, - toastService, - ); - } - - protected async init() { - // Do nothing since cipher is already decoded - } - - protected showFixOldAttachments(attachment: AttachmentView) { - return false; - } -} diff --git a/apps/web/src/app/auth/settings/emergency-access/view/emergency-access-view.component.html b/apps/web/src/app/auth/settings/emergency-access/view/emergency-access-view.component.html index a936e3a427d..87e2643c178 100644 --- a/apps/web/src/app/auth/settings/emergency-access/view/emergency-access-view.component.html +++ b/apps/web/src/app/auth/settings/emergency-access/view/emergency-access-view.component.html @@ -38,28 +38,6 @@
{{ currentCipher.subTitle }} - -
- - - - -
- diff --git a/apps/web/src/app/auth/settings/emergency-access/view/emergency-access-view.component.ts b/apps/web/src/app/auth/settings/emergency-access/view/emergency-access-view.component.ts index 1e3d0cf705f..bf7ca29da9b 100644 --- a/apps/web/src/app/auth/settings/emergency-access/view/emergency-access-view.component.ts +++ b/apps/web/src/app/auth/settings/emergency-access/view/emergency-access-view.component.ts @@ -1,15 +1,13 @@ -// FIXME: Update this file to be type safe and remove this and next line -// @ts-strict-ignore import { Component, OnInit, ViewChild, ViewContainerRef } from "@angular/core"; import { ActivatedRoute, Router } from "@angular/router"; +import { firstValueFrom } from "rxjs"; -import { ModalService } from "@bitwarden/angular/services/modal.service"; +import { EmergencyAccessId } from "@bitwarden/common/types/guid"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { DialogService } from "@bitwarden/components"; import { CipherFormConfigService, DefaultCipherFormConfigService } from "@bitwarden/vault"; import { EmergencyAccessService } from "../../../emergency-access"; -import { EmergencyAccessAttachmentsComponent } from "../attachments/emergency-access-attachments.component"; import { EmergencyViewDialogComponent } from "./emergency-view-dialog.component"; @@ -20,56 +18,34 @@ import { EmergencyViewDialogComponent } from "./emergency-view-dialog.component" }) export class EmergencyAccessViewComponent implements OnInit { @ViewChild("attachments", { read: ViewContainerRef, static: true }) - attachmentsModalRef: ViewContainerRef; - - id: string; + id: EmergencyAccessId | null = null; ciphers: CipherView[] = []; loaded = false; constructor( - private modalService: ModalService, private router: Router, private route: ActivatedRoute, private emergencyAccessService: EmergencyAccessService, private dialogService: DialogService, ) {} - ngOnInit() { - // eslint-disable-next-line rxjs-angular/prefer-takeuntil - this.route.params.subscribe((qParams) => { - if (qParams.id == null) { - return this.router.navigate(["settings/emergency-access"]); - } + async ngOnInit() { + const qParams = await firstValueFrom(this.route.params); + if (qParams.id == null) { + await this.router.navigate(["settings/emergency-access"]); + return; + } - this.id = qParams.id; - - // FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling. - // eslint-disable-next-line @typescript-eslint/no-floating-promises - this.load(); - }); + this.id = qParams.id; + this.ciphers = await this.emergencyAccessService.getViewOnlyCiphers(qParams.id); + this.loaded = true; } async selectCipher(cipher: CipherView) { EmergencyViewDialogComponent.open(this.dialogService, { cipher, + emergencyAccessId: this.id!, }); return; } - - async load() { - this.ciphers = await this.emergencyAccessService.getViewOnlyCiphers(this.id); - this.loaded = true; - } - - // FIXME PM-17747: This will also need to be replaced with the new AttachmentViewDialog - async viewAttachments(cipher: CipherView) { - await this.modalService.openViewRef( - EmergencyAccessAttachmentsComponent, - this.attachmentsModalRef, - (comp) => { - comp.cipher = cipher; - comp.emergencyAccessId = this.id; - }, - ); - } } diff --git a/apps/web/src/app/auth/settings/emergency-access/view/emergency-view-dialog.component.html b/apps/web/src/app/auth/settings/emergency-access/view/emergency-view-dialog.component.html index be38e1d9505..b3d8e48260a 100644 --- a/apps/web/src/app/auth/settings/emergency-access/view/emergency-view-dialog.component.html +++ b/apps/web/src/app/auth/settings/emergency-access/view/emergency-view-dialog.component.html @@ -3,7 +3,7 @@ {{ title }}
- +