Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking โ€œSign up for GitHubโ€, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PM-12985] - Updating reports to use new modal for view/edit cipher #12383

Open
wants to merge 45 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
255291b
Updating reports to use new modal for view/edit cipher
Dec 12, 2024
7e9ddc1
Merge branch 'main' into PM-12985-Reports
cd-bitwarden Dec 18, 2024
04c1e76
updating the location of the DefaultCipherFormCOnfigService
Dec 19, 2024
208c5f6
Merge branch 'main' into PM-12985-Reports
cd-bitwarden Dec 19, 2024
e0ffcf6
Test fixes
Dec 19, 2024
578c3d4
Merge branch 'PM-12985-Reports' of github.com:bitwarden/clients into โ€ฆ
Dec 19, 2024
d730852
test fixes
Dec 19, 2024
72cc46b
Adding back useful code and trying to fix inactive-two-factor-report.โ€ฆ
Dec 20, 2024
03e6be2
Merge branch 'main' into PM-12985-Reports
cd-bitwarden Dec 20, 2024
c698779
suggested changes
Dec 21, 2024
859f179
Merge branch 'PM-12985-Reports' of github.com:bitwarden/clients into โ€ฆ
Dec 21, 2024
7f5d84f
Merge branch 'main' into PM-12985-Reports
cd-bitwarden Jan 7, 2025
1258ea2
Merge branch 'main' into PM-12985-Reports
cd-bitwarden Jan 7, 2025
a899618
Merge branch 'main' into PM-12985-Reports
cd-bitwarden Jan 7, 2025
c3442d6
trying to fix tests
Jan 7, 2025
ea7a67c
Merge branch 'PM-12985-Reports' of github.com:bitwarden/clients into โ€ฆ
Jan 7, 2025
f4ca2cf
test fix
Jan 7, 2025
cdc7695
fixing reports
Jan 8, 2025
9a52125
Merge branch 'main' into PM-12985-Reports
cd-bitwarden Jan 8, 2025
c280cfb
Fix import path
djsmith85 Jan 9, 2025
9a19dc9
Remove unnecessary change
djsmith85 Jan 9, 2025
d94bdc4
Revert "Remove unnecessary change"
djsmith85 Jan 9, 2025
3a2ec70
Merge branch 'main' into PM-12985-Reports
bnagawiecki Jan 13, 2025
134f7fc
PM-16995- Provide missing CipherFormConfigService
djsmith85 Jan 14, 2025
4653c1d
Merge branch 'PM-12985-Reports' of https://github.com/bitwarden/clienโ€ฆ
djsmith85 Jan 14, 2025
55f9304
Merge branch 'main' into PM-12985-Reports
cd-bitwarden Jan 21, 2025
b20cca7
Merge branch 'main' into PM-12985-Reports
cd-bitwarden Jan 21, 2025
2c55e27
Merge branch 'main' into PM-12985-Reports
Jan 22, 2025
4fc038a
after merge fixes
Jan 22, 2025
04ec3eb
more fixes
Jan 22, 2025
d0f1e22
WIP
Jan 24, 2025
23cbc06
wip: fix for exposed passwords
coroiu Jan 24, 2025
b6688e1
WIP
Jan 24, 2025
d46d56d
fixing tests
Jan 28, 2025
f0261f5
removing uneeded change
Jan 28, 2025
28ac0a5
lint fixes
Jan 28, 2025
ec98466
Merge branch 'main' into PM-12985-Reports
cd-bitwarden Jan 28, 2025
8942ebd
lint fix
Jan 28, 2025
7db1d3c
Merge branch 'main' into PM-12985-Reports
cd-bitwarden Jan 28, 2025
84d452d
Merge branch 'main' into PM-12985-Reports
Feb 5, 2025
27f1efb
fixing admin console permissions
Feb 6, 2025
e3bbd01
Merge branch 'main' into PM-12985-Reports
Feb 7, 2025
3bdd951
Merge branch 'main' into PM-12985-Reports
Feb 13, 2025
2336ede
merge fix
Feb 14, 2025
4a70fb3
Merge branch 'main' into PM-12985-Reports
cd-bitwarden Feb 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@ import { Component, OnInit } from "@angular/core";
import { ActivatedRoute } from "@angular/router";
import { firstValueFrom } from "rxjs";

import { ModalService } from "@bitwarden/angular/services/modal.service";
import { AuditService } from "@bitwarden/common/abstractions/audit.service";
import {
getOrganizationById,
@@ -17,14 +16,27 @@ import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.servi
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";
import { Cipher } from "@bitwarden/common/vault/models/domain/cipher";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import { PasswordRepromptService } from "@bitwarden/vault";
import { DialogService } from "@bitwarden/components";
import { PasswordRepromptService, CipherFormConfigService } from "@bitwarden/vault";

// eslint-disable-next-line no-restricted-imports
import { ExposedPasswordsReportComponent as BaseExposedPasswordsReportComponent } from "../../../tools/reports/pages/exposed-passwords-report.component";
import { RoutedVaultFilterBridgeService } from "../../../vault/individual-vault/vault-filter/services/routed-vault-filter-bridge.service";
import { RoutedVaultFilterService } from "../../../vault/individual-vault/vault-filter/services/routed-vault-filter.service";
import { AdminConsoleCipherFormConfigService } from "../../../vault/org-vault/services/admin-console-cipher-form-config.service";

@Component({
selector: "app-org-exposed-passwords-report",
templateUrl: "../../../tools/reports/pages/exposed-passwords-report.component.html",
providers: [
{
provide: CipherFormConfigService,
useClass: AdminConsoleCipherFormConfigService,
},
AdminConsoleCipherFormConfigService,
RoutedVaultFilterService,
RoutedVaultFilterBridgeService,
],
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class ExposedPasswordsReportComponent
@@ -36,23 +48,27 @@ export class ExposedPasswordsReportComponent
constructor(
cipherService: CipherService,
auditService: AuditService,
modalService: ModalService,
dialogService: DialogService,
organizationService: OrganizationService,
protected accountService: AccountService,
private route: ActivatedRoute,
passwordRepromptService: PasswordRepromptService,
i18nService: I18nService,
syncService: SyncService,
cipherFormService: CipherFormConfigService,
adminConsoleCipherFormConfigService: AdminConsoleCipherFormConfigService,
) {
super(
cipherService,
auditService,
organizationService,
dialogService,
accountService,
modalService,
passwordRepromptService,
i18nService,
syncService,
cipherFormService,
adminConsoleCipherFormConfigService,
);
}

Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@ import { Component, OnInit } from "@angular/core";
import { ActivatedRoute } from "@angular/router";
import { firstValueFrom, map } from "rxjs";

import { ModalService } from "@bitwarden/angular/services/modal.service";
import {
getOrganizationById,
OrganizationService,
@@ -15,14 +14,27 @@ import { LogService } from "@bitwarden/common/platform/abstractions/log.service"
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import { PasswordRepromptService } from "@bitwarden/vault";
import { DialogService } from "@bitwarden/components";
import { CipherFormConfigService, PasswordRepromptService } from "@bitwarden/vault";

// eslint-disable-next-line no-restricted-imports
import { InactiveTwoFactorReportComponent as BaseInactiveTwoFactorReportComponent } from "../../../tools/reports/pages/inactive-two-factor-report.component";
import { RoutedVaultFilterBridgeService } from "../../../vault/individual-vault/vault-filter/services/routed-vault-filter-bridge.service";
import { RoutedVaultFilterService } from "../../../vault/individual-vault/vault-filter/services/routed-vault-filter.service";
import { AdminConsoleCipherFormConfigService } from "../../../vault/org-vault/services/admin-console-cipher-form-config.service";

@Component({
selector: "app-inactive-two-factor-report",
templateUrl: "../../../tools/reports/pages/inactive-two-factor-report.component.html",
providers: [
{
provide: CipherFormConfigService,
useClass: AdminConsoleCipherFormConfigService,
},
AdminConsoleCipherFormConfigService,
RoutedVaultFilterService,
RoutedVaultFilterBridgeService,
],
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class InactiveTwoFactorReportComponent
@@ -31,24 +43,28 @@ export class InactiveTwoFactorReportComponent
{
constructor(
cipherService: CipherService,
modalService: ModalService,
dialogService: DialogService,
private route: ActivatedRoute,
logService: LogService,
passwordRepromptService: PasswordRepromptService,
organizationService: OrganizationService,
accountService: AccountService,
i18nService: I18nService,
syncService: SyncService,
cipherFormConfigService: CipherFormConfigService,
adminConsoleCipherFormConfigService: AdminConsoleCipherFormConfigService,
) {
super(
cipherService,
organizationService,
dialogService,
accountService,
modalService,
logService,
passwordRepromptService,
i18nService,
syncService,
cipherFormConfigService,
adminConsoleCipherFormConfigService,
);
}

Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@ import { Component, OnInit } from "@angular/core";
import { ActivatedRoute } from "@angular/router";
import { firstValueFrom } from "rxjs";

import { ModalService } from "@bitwarden/angular/services/modal.service";
import {
getOrganizationById,
OrganizationService,
@@ -16,14 +15,27 @@ import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.servi
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";
import { Cipher } from "@bitwarden/common/vault/models/domain/cipher";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import { PasswordRepromptService } from "@bitwarden/vault";
import { DialogService } from "@bitwarden/components";
import { CipherFormConfigService, PasswordRepromptService } from "@bitwarden/vault";

// eslint-disable-next-line no-restricted-imports
import { ReusedPasswordsReportComponent as BaseReusedPasswordsReportComponent } from "../../../tools/reports/pages/reused-passwords-report.component";
import { RoutedVaultFilterBridgeService } from "../../../vault/individual-vault/vault-filter/services/routed-vault-filter-bridge.service";
import { RoutedVaultFilterService } from "../../../vault/individual-vault/vault-filter/services/routed-vault-filter.service";
import { AdminConsoleCipherFormConfigService } from "../../../vault/org-vault/services/admin-console-cipher-form-config.service";

@Component({
selector: "app-reused-passwords-report",
templateUrl: "../../../tools/reports/pages/reused-passwords-report.component.html",
providers: [
{
provide: CipherFormConfigService,
useClass: AdminConsoleCipherFormConfigService,
},
AdminConsoleCipherFormConfigService,
RoutedVaultFilterService,
RoutedVaultFilterBridgeService,
],
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class ReusedPasswordsReportComponent
@@ -34,22 +46,26 @@ export class ReusedPasswordsReportComponent

constructor(
cipherService: CipherService,
modalService: ModalService,
dialogService: DialogService,
private route: ActivatedRoute,
organizationService: OrganizationService,
protected accountService: AccountService,
passwordRepromptService: PasswordRepromptService,
i18nService: I18nService,
syncService: SyncService,
cipherFormConfigService: CipherFormConfigService,
adminConsoleCipherFormConfigService: AdminConsoleCipherFormConfigService,
) {
super(
cipherService,
organizationService,
dialogService,
accountService,
modalService,
passwordRepromptService,
i18nService,
syncService,
cipherFormConfigService,
adminConsoleCipherFormConfigService,
);
}

Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@ import { ActivatedRoute } from "@angular/router";
import { firstValueFrom, map } from "rxjs";

import { CollectionService } from "@bitwarden/admin-console/common";
import { ModalService } from "@bitwarden/angular/services/modal.service";
import {
getOrganizationById,
OrganizationService,
@@ -15,14 +14,27 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import { PasswordRepromptService } from "@bitwarden/vault";
import { DialogService } from "@bitwarden/components";
import { CipherFormConfigService, PasswordRepromptService } from "@bitwarden/vault";

// eslint-disable-next-line no-restricted-imports
import { UnsecuredWebsitesReportComponent as BaseUnsecuredWebsitesReportComponent } from "../../../tools/reports/pages/unsecured-websites-report.component";
import { RoutedVaultFilterBridgeService } from "../../../vault/individual-vault/vault-filter/services/routed-vault-filter-bridge.service";
import { RoutedVaultFilterService } from "../../../vault/individual-vault/vault-filter/services/routed-vault-filter.service";
import { AdminConsoleCipherFormConfigService } from "../../../vault/org-vault/services/admin-console-cipher-form-config.service";

@Component({
selector: "app-unsecured-websites-report",
templateUrl: "../../../tools/reports/pages/unsecured-websites-report.component.html",
providers: [
{
provide: CipherFormConfigService,
useClass: AdminConsoleCipherFormConfigService,
},
AdminConsoleCipherFormConfigService,
RoutedVaultFilterService,
RoutedVaultFilterBridgeService,
],
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class UnsecuredWebsitesReportComponent
@@ -31,24 +43,28 @@ export class UnsecuredWebsitesReportComponent
{
constructor(
cipherService: CipherService,
modalService: ModalService,
dialogService: DialogService,
private route: ActivatedRoute,
organizationService: OrganizationService,
protected accountService: AccountService,
passwordRepromptService: PasswordRepromptService,
i18nService: I18nService,
syncService: SyncService,
collectionService: CollectionService,
cipherFormConfigService: CipherFormConfigService,
adminConsoleCipherFormConfigService: AdminConsoleCipherFormConfigService,
) {
super(
cipherService,
organizationService,
dialogService,
accountService,
modalService,
passwordRepromptService,
i18nService,
syncService,
collectionService,
cipherFormConfigService,
adminConsoleCipherFormConfigService,
);
}

Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@ import { Component, OnInit } from "@angular/core";
import { ActivatedRoute } from "@angular/router";
import { firstValueFrom } from "rxjs";

import { ModalService } from "@bitwarden/angular/services/modal.service";
import {
getOrganizationById,
OrganizationService,
@@ -17,14 +16,27 @@ import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.servi
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";
import { Cipher } from "@bitwarden/common/vault/models/domain/cipher";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import { PasswordRepromptService } from "@bitwarden/vault";
import { DialogService } from "@bitwarden/components";
import { CipherFormConfigService, PasswordRepromptService } from "@bitwarden/vault";

// eslint-disable-next-line no-restricted-imports
import { WeakPasswordsReportComponent as BaseWeakPasswordsReportComponent } from "../../../tools/reports/pages/weak-passwords-report.component";
import { RoutedVaultFilterBridgeService } from "../../../vault/individual-vault/vault-filter/services/routed-vault-filter-bridge.service";
import { RoutedVaultFilterService } from "../../../vault/individual-vault/vault-filter/services/routed-vault-filter.service";
import { AdminConsoleCipherFormConfigService } from "../../../vault/org-vault/services/admin-console-cipher-form-config.service";

@Component({
selector: "app-weak-passwords-report",
templateUrl: "../../../tools/reports/pages/weak-passwords-report.component.html",
providers: [
{
provide: CipherFormConfigService,
useClass: AdminConsoleCipherFormConfigService,
},
AdminConsoleCipherFormConfigService,
RoutedVaultFilterService,
RoutedVaultFilterBridgeService,
],
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class WeakPasswordsReportComponent
@@ -36,23 +48,27 @@ export class WeakPasswordsReportComponent
constructor(
cipherService: CipherService,
passwordStrengthService: PasswordStrengthServiceAbstraction,
modalService: ModalService,
dialogService: DialogService,
private route: ActivatedRoute,
organizationService: OrganizationService,
passwordRepromptService: PasswordRepromptService,
i18nService: I18nService,
syncService: SyncService,
cipherFormConfigService: CipherFormConfigService,
protected accountService: AccountService,
adminConsoleCipherFormConfigService: AdminConsoleCipherFormConfigService,
) {
super(
cipherService,
passwordStrengthService,
organizationService,
dialogService,
accountService,
modalService,
passwordRepromptService,
i18nService,
syncService,
cipherFormConfigService,
adminConsoleCipherFormConfigService,
);
}

115 changes: 77 additions & 38 deletions apps/web/src/app/tools/reports/pages/cipher-report.component.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,40 @@
// FIXME: Update this file to be type safe and remove this and next line
// @ts-strict-ignore
import { DialogRef } from "@angular/cdk/dialog";
import { Directive, ViewChild, ViewContainerRef, OnDestroy } from "@angular/core";
import { BehaviorSubject, Observable, Subject, firstValueFrom, switchMap, takeUntil } from "rxjs";
import {
BehaviorSubject,
lastValueFrom,
Observable,
Subject,
firstValueFrom,
switchMap,
takeUntil,
} from "rxjs";

import { ModalService } from "@bitwarden/angular/services/modal.service";
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { getUserId } from "@bitwarden/common/auth/services/account.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { OrganizationId } from "@bitwarden/common/types/guid";
import { CipherId, CollectionId, OrganizationId } from "@bitwarden/common/types/guid";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";
import { CipherRepromptType } from "@bitwarden/common/vault/enums/cipher-reprompt-type";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import { TableDataSource } from "@bitwarden/components";
import { PasswordRepromptService } from "@bitwarden/vault";

import { AddEditComponent } from "../../../vault/individual-vault/add-edit.component";
import { AddEditComponent as OrgAddEditComponent } from "../../../vault/org-vault/add-edit.component";
import { TableDataSource, DialogService } from "@bitwarden/components";
import {
CipherFormConfig,
CipherFormConfigService,
PasswordRepromptService,
} from "@bitwarden/vault";

import {
VaultItemDialogComponent,
VaultItemDialogMode,
VaultItemDialogResult,
} from "../../../vault/components/vault-item-dialog/vault-item-dialog.component";
import { AdminConsoleCipherFormConfigService } from "../../../vault/org-vault/services/admin-console-cipher-form-config.service";

@Directive()
export class CipherReportComponent implements OnDestroy {
@@ -41,15 +57,18 @@
currentFilterStatus: number | string;
protected filterOrgStatus$ = new BehaviorSubject<number | string>(0);
private destroyed$: Subject<void> = new Subject();
private vaultItemDialogRef?: DialogRef<VaultItemDialogResult> | undefined;

constructor(
protected cipherService: CipherService,
private modalService: ModalService,
private dialogService: DialogService,
protected passwordRepromptService: PasswordRepromptService,
protected organizationService: OrganizationService,
protected accountService: AccountService,
protected i18nService: I18nService,
private syncService: SyncService,
private cipherFormConfigService: CipherFormConfigService,
private adminConsoleCipherFormConfigService: AdminConsoleCipherFormConfigService,
) {
this.organizations$ = this.accountService.activeAccount$.pipe(
getUserId,
@@ -134,43 +153,63 @@
this.loading = false;
this.hasLoaded = true;
}

async selectCipher(cipher: CipherView) {
if (!(await this.repromptCipher(cipher))) {
return;
}

const type = this.organization != null ? OrgAddEditComponent : AddEditComponent;
if (this.organization) {
const adminCipherFormConfig = await this.adminConsoleCipherFormConfigService.buildConfig(

Check warning on line 162 in apps/web/src/app/tools/reports/pages/cipher-report.component.ts

Codecov / codecov/patch

apps/web/src/app/tools/reports/pages/cipher-report.component.ts#L162

Added line #L162 was not covered by tests
"edit",
cipher.id as CipherId,
cipher.type,
);

const [modal, childComponent] = await this.modalService.openViewRef(
type,
this.cipherAddEditModalRef,
(comp: OrgAddEditComponent | AddEditComponent) => {
if (this.organization != null) {
(comp as OrgAddEditComponent).organization = this.organization;
comp.organizationId = this.organization.id;
}
await this.openVaultItemDialog("view", adminCipherFormConfig, cipher);

Check warning on line 168 in apps/web/src/app/tools/reports/pages/cipher-report.component.ts

Codecov / codecov/patch

apps/web/src/app/tools/reports/pages/cipher-report.component.ts#L168

Added line #L168 was not covered by tests
} else {
const cipherFormConfig = await this.cipherFormConfigService.buildConfig(

Check warning on line 170 in apps/web/src/app/tools/reports/pages/cipher-report.component.ts

Codecov / codecov/patch

apps/web/src/app/tools/reports/pages/cipher-report.component.ts#L170

Added line #L170 was not covered by tests
"edit",
cipher.id as CipherId,
cipher.type,
);
await this.openVaultItemDialog("view", cipherFormConfig, cipher);

Check warning on line 175 in apps/web/src/app/tools/reports/pages/cipher-report.component.ts

Codecov / codecov/patch

apps/web/src/app/tools/reports/pages/cipher-report.component.ts#L175

Added line #L175 was not covered by tests
}
}

comp.cipherId = cipher == null ? null : cipher.id;
// eslint-disable-next-line rxjs/no-async-subscribe
comp.onSavedCipher.subscribe(async () => {
modal.close();
await this.load();
});
// eslint-disable-next-line rxjs/no-async-subscribe
comp.onDeletedCipher.subscribe(async () => {
modal.close();
await this.load();
});
// eslint-disable-next-line rxjs/no-async-subscribe
comp.onRestoredCipher.subscribe(async () => {
modal.close();
await this.load();
});
},
);
/**
* Open the combined view / edit dialog for a cipher.
* @param mode - Starting mode of the dialog.
* @param formConfig - Configuration for the form when editing/adding a cipher.
* @param activeCollectionId - The active collection ID.
*/
async openVaultItemDialog(
mode: VaultItemDialogMode,
formConfig: CipherFormConfig,
cipher: CipherView,
activeCollectionId?: CollectionId,
) {
const disableForm = cipher ? !cipher.edit && !this.organization.canEditAllCiphers : false;

return childComponent;
this.vaultItemDialogRef = VaultItemDialogComponent.open(this.dialogService, {

Check warning on line 193 in apps/web/src/app/tools/reports/pages/cipher-report.component.ts

Codecov / codecov/patch

apps/web/src/app/tools/reports/pages/cipher-report.component.ts#L193

Added line #L193 was not covered by tests
mode,
formConfig,
activeCollectionId,
disableForm,
});

const result = await lastValueFrom(this.vaultItemDialogRef.closed);
this.vaultItemDialogRef = undefined;

Check warning on line 201 in apps/web/src/app/tools/reports/pages/cipher-report.component.ts

Codecov / codecov/patch

apps/web/src/app/tools/reports/pages/cipher-report.component.ts#L200-L201

Added lines #L200 - L201 were not covered by tests

// When the dialog is closed for a premium upgrade, return early as the user
// should be navigated to the subscription settings elsewhere
if (result === VaultItemDialogResult.PremiumUpgrade) {
return;

Check warning on line 206 in apps/web/src/app/tools/reports/pages/cipher-report.component.ts

Codecov / codecov/patch

apps/web/src/app/tools/reports/pages/cipher-report.component.ts#L206

Added line #L206 was not covered by tests
}

// If the dialog was closed by deleting the cipher, refresh the report.
if (result === VaultItemDialogResult.Deleted || result === VaultItemDialogResult.Saved) {
await this.load();

Check warning on line 211 in apps/web/src/app/tools/reports/pages/cipher-report.component.ts

Codecov / codecov/patch

apps/web/src/app/tools/reports/pages/cipher-report.component.ts#L211

Added line #L211 was not covered by tests
}
}

protected async setCiphers() {
Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@ import { mock, MockProxy } from "jest-mock-extended";
import { of } from "rxjs";

import { I18nPipe } from "@bitwarden/angular/platform/pipes/i18n.pipe";
import { ModalService } from "@bitwarden/angular/services/modal.service";
import { AuditService } from "@bitwarden/common/abstractions/audit.service";
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
@@ -14,7 +13,10 @@ import { FakeAccountService, mockAccountServiceWith } from "@bitwarden/common/sp
import { UserId } from "@bitwarden/common/types/guid";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";
import { PasswordRepromptService } from "@bitwarden/vault";
import { DialogService } from "@bitwarden/components";
import { CipherFormConfigService, PasswordRepromptService } from "@bitwarden/vault";

import { AdminConsoleCipherFormConfigService } from "../../../vault/org-vault/services/admin-console-cipher-form-config.service";

import { ExposedPasswordsReportComponent } from "./exposed-passwords-report.component";
import { cipherData } from "./reports-ciphers.mock";
@@ -25,10 +27,12 @@ describe("ExposedPasswordsReportComponent", () => {
let auditService: MockProxy<AuditService>;
let organizationService: MockProxy<OrganizationService>;
let syncServiceMock: MockProxy<SyncService>;
let adminConsoleCipherFormConfigServiceMock: MockProxy<AdminConsoleCipherFormConfigService>;
const userId = Utils.newGuid() as UserId;
const accountService: FakeAccountService = mockAccountServiceWith(userId);

beforeEach(() => {
let cipherFormConfigServiceMock: MockProxy<CipherFormConfigService>;
syncServiceMock = mock<SyncService>();
auditService = mock<AuditService>();
organizationService = mock<OrganizationService>();
@@ -55,8 +59,8 @@ describe("ExposedPasswordsReportComponent", () => {
useValue: accountService,
},
{
provide: ModalService,
useValue: mock<ModalService>(),
provide: DialogService,
useValue: mock<DialogService>(),
},
{
provide: PasswordRepromptService,
@@ -70,6 +74,14 @@ describe("ExposedPasswordsReportComponent", () => {
provide: I18nService,
useValue: mock<I18nService>(),
},
{
provide: CipherFormConfigService,
useValue: cipherFormConfigServiceMock,
},
{
provide: AdminConsoleCipherFormConfigService,
useValue: adminConsoleCipherFormConfigServiceMock,
},
],
schemas: [],
}).compileComponents();
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Component, OnInit } from "@angular/core";

import { ModalService } from "@bitwarden/angular/services/modal.service";
import { AuditService } from "@bitwarden/common/abstractions/audit.service";
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
@@ -9,7 +8,10 @@ import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.servi
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";
import { CipherType } from "@bitwarden/common/vault/enums";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import { PasswordRepromptService } from "@bitwarden/vault";
import { DialogService } from "@bitwarden/components";
import { CipherFormConfigService, PasswordRepromptService } from "@bitwarden/vault";

import { AdminConsoleCipherFormConfigService } from "../../../vault/org-vault/services/admin-console-cipher-form-config.service";

import { CipherReportComponent } from "./cipher-report.component";

@@ -26,20 +28,24 @@ export class ExposedPasswordsReportComponent extends CipherReportComponent imple
protected cipherService: CipherService,
protected auditService: AuditService,
protected organizationService: OrganizationService,
dialogService: DialogService,
accountService: AccountService,
modalService: ModalService,
passwordRepromptService: PasswordRepromptService,
i18nService: I18nService,
syncService: SyncService,
cipherFormConfigService: CipherFormConfigService,
adminConsoleCipherFormConfigService: AdminConsoleCipherFormConfigService,
) {
super(
cipherService,
modalService,
dialogService,
passwordRepromptService,
organizationService,
accountService,
i18nService,
syncService,
cipherFormConfigService,
adminConsoleCipherFormConfigService,
);
}

Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@ import { MockProxy, mock } from "jest-mock-extended";
import { of } from "rxjs";

import { I18nPipe } from "@bitwarden/angular/platform/pipes/i18n.pipe";
import { ModalService } from "@bitwarden/angular/services/modal.service";
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
@@ -14,7 +13,10 @@ import { FakeAccountService, mockAccountServiceWith } from "@bitwarden/common/sp
import { UserId } from "@bitwarden/common/types/guid";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";
import { PasswordRepromptService } from "@bitwarden/vault";
import { DialogService } from "@bitwarden/components";
import { CipherFormConfigService, PasswordRepromptService } from "@bitwarden/vault";

import { AdminConsoleCipherFormConfigService } from "../../../vault/org-vault/services/admin-console-cipher-form-config.service";

import { InactiveTwoFactorReportComponent } from "./inactive-two-factor-report.component";
import { cipherData } from "./reports-ciphers.mock";
@@ -24,10 +26,12 @@ describe("InactiveTwoFactorReportComponent", () => {
let fixture: ComponentFixture<InactiveTwoFactorReportComponent>;
let organizationService: MockProxy<OrganizationService>;
let syncServiceMock: MockProxy<SyncService>;
let adminConsoleCipherFormConfigServiceMock: MockProxy<AdminConsoleCipherFormConfigService>;
const userId = Utils.newGuid() as UserId;
const accountService: FakeAccountService = mockAccountServiceWith(userId);

beforeEach(() => {
let cipherFormConfigServiceMock: MockProxy<CipherFormConfigService>;
organizationService = mock<OrganizationService>();
organizationService.organizations$.mockReturnValue(of([]));
syncServiceMock = mock<SyncService>();
@@ -49,8 +53,8 @@ describe("InactiveTwoFactorReportComponent", () => {
useValue: accountService,
},
{
provide: ModalService,
useValue: mock<ModalService>(),
provide: DialogService,
useValue: mock<DialogService>(),
},
{
provide: LogService,
@@ -68,6 +72,14 @@ describe("InactiveTwoFactorReportComponent", () => {
provide: I18nService,
useValue: mock<I18nService>(),
},
{
provide: CipherFormConfigService,
useValue: cipherFormConfigServiceMock,
},
{
provide: AdminConsoleCipherFormConfigService,
useValue: adminConsoleCipherFormConfigServiceMock,
},
],
schemas: [],
}).compileComponents();
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@
// @ts-strict-ignore
import { Component, OnInit } from "@angular/core";

import { ModalService } from "@bitwarden/angular/services/modal.service";
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
@@ -12,7 +11,10 @@ import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.servi
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";
import { CipherType } from "@bitwarden/common/vault/enums";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import { PasswordRepromptService } from "@bitwarden/vault";
import { DialogService } from "@bitwarden/components";
import { CipherFormConfigService, PasswordRepromptService } from "@bitwarden/vault";

import { AdminConsoleCipherFormConfigService } from "../../../vault/org-vault/services/admin-console-cipher-form-config.service";

import { CipherReportComponent } from "./cipher-report.component";

@@ -28,21 +30,25 @@ export class InactiveTwoFactorReportComponent extends CipherReportComponent impl
constructor(
protected cipherService: CipherService,
protected organizationService: OrganizationService,
dialogService: DialogService,
accountService: AccountService,
modalService: ModalService,
private logService: LogService,
passwordRepromptService: PasswordRepromptService,
i18nService: I18nService,
syncService: SyncService,
cipherFormConfigService: CipherFormConfigService,
adminConsoleCipherFormConfigService: AdminConsoleCipherFormConfigService,
) {
super(
cipherService,
modalService,
dialogService,
passwordRepromptService,
organizationService,
accountService,
i18nService,
syncService,
cipherFormConfigService,
adminConsoleCipherFormConfigService,
);
}

Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@ import { MockProxy, mock } from "jest-mock-extended";
import { of } from "rxjs";

import { I18nPipe } from "@bitwarden/angular/platform/pipes/i18n.pipe";
import { ModalService } from "@bitwarden/angular/services/modal.service";
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
@@ -13,7 +12,10 @@ import { FakeAccountService, mockAccountServiceWith } from "@bitwarden/common/sp
import { UserId } from "@bitwarden/common/types/guid";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";
import { PasswordRepromptService } from "@bitwarden/vault";
import { DialogService } from "@bitwarden/components";
import { CipherFormConfigService, PasswordRepromptService } from "@bitwarden/vault";

import { AdminConsoleCipherFormConfigService } from "../../../vault/org-vault/services/admin-console-cipher-form-config.service";

import { cipherData } from "./reports-ciphers.mock";
import { ReusedPasswordsReportComponent } from "./reused-passwords-report.component";
@@ -23,10 +25,12 @@ describe("ReusedPasswordsReportComponent", () => {
let fixture: ComponentFixture<ReusedPasswordsReportComponent>;
let organizationService: MockProxy<OrganizationService>;
let syncServiceMock: MockProxy<SyncService>;
let adminConsoleCipherFormConfigServiceMock: MockProxy<AdminConsoleCipherFormConfigService>;
const userId = Utils.newGuid() as UserId;
const accountService: FakeAccountService = mockAccountServiceWith(userId);

beforeEach(() => {
let cipherFormConfigServiceMock: MockProxy<CipherFormConfigService>;
organizationService = mock<OrganizationService>();
organizationService.organizations$.mockReturnValue(of([]));
syncServiceMock = mock<SyncService>();
@@ -48,8 +52,8 @@ describe("ReusedPasswordsReportComponent", () => {
useValue: accountService,
},
{
provide: ModalService,
useValue: mock<ModalService>(),
provide: DialogService,
useValue: mock<DialogService>(),
},
{
provide: PasswordRepromptService,
@@ -63,6 +67,14 @@ describe("ReusedPasswordsReportComponent", () => {
provide: I18nService,
useValue: mock<I18nService>(),
},
{
provide: CipherFormConfigService,
useValue: cipherFormConfigServiceMock,
},
{
provide: AdminConsoleCipherFormConfigService,
useValue: adminConsoleCipherFormConfigServiceMock,
},
],
schemas: [],
}).compileComponents();
Original file line number Diff line number Diff line change
@@ -2,15 +2,17 @@
// @ts-strict-ignore
import { Component, OnInit } from "@angular/core";

import { ModalService } from "@bitwarden/angular/services/modal.service";
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";
import { CipherType } from "@bitwarden/common/vault/enums";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import { PasswordRepromptService } from "@bitwarden/vault";
import { DialogService } from "@bitwarden/components";
import { CipherFormConfigService, PasswordRepromptService } from "@bitwarden/vault";

import { AdminConsoleCipherFormConfigService } from "../../../vault/org-vault/services/admin-console-cipher-form-config.service";

import { CipherReportComponent } from "./cipher-report.component";

@@ -25,20 +27,24 @@ export class ReusedPasswordsReportComponent extends CipherReportComponent implem
constructor(
protected cipherService: CipherService,
protected organizationService: OrganizationService,
dialogService: DialogService,
accountService: AccountService,
modalService: ModalService,
passwordRepromptService: PasswordRepromptService,
i18nService: I18nService,
syncService: SyncService,
cipherFormConfigService: CipherFormConfigService,
adminConsoleCipherFormConfigService: AdminConsoleCipherFormConfigService,
) {
super(
cipherService,
modalService,
dialogService,
passwordRepromptService,
organizationService,
accountService,
i18nService,
syncService,
cipherFormConfigService,
adminConsoleCipherFormConfigService,
);
}

Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@ import { of } from "rxjs";

import { CollectionService } from "@bitwarden/admin-console/common";
import { I18nPipe } from "@bitwarden/angular/platform/pipes/i18n.pipe";
import { ModalService } from "@bitwarden/angular/services/modal.service";
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
@@ -14,7 +13,10 @@ import { FakeAccountService, mockAccountServiceWith } from "@bitwarden/common/sp
import { UserId } from "@bitwarden/common/types/guid";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";
import { PasswordRepromptService } from "@bitwarden/vault";
import { DialogService } from "@bitwarden/components";
import { CipherFormConfigService, PasswordRepromptService } from "@bitwarden/vault";

import { AdminConsoleCipherFormConfigService } from "../../../vault/org-vault/services/admin-console-cipher-form-config.service";

import { cipherData } from "./reports-ciphers.mock";
import { UnsecuredWebsitesReportComponent } from "./unsecured-websites-report.component";
@@ -25,14 +27,18 @@ describe("UnsecuredWebsitesReportComponent", () => {
let organizationService: MockProxy<OrganizationService>;
let syncServiceMock: MockProxy<SyncService>;
let collectionService: MockProxy<CollectionService>;
let adminConsoleCipherFormConfigService: MockProxy<AdminConsoleCipherFormConfigService>;
const userId = Utils.newGuid() as UserId;
const accountService: FakeAccountService = mockAccountServiceWith(userId);

beforeEach(() => {
let cipherFormConfigServiceMock: MockProxy<CipherFormConfigService>;
organizationService = mock<OrganizationService>();
organizationService.organizations$.mockReturnValue(of([]));
syncServiceMock = mock<SyncService>();
collectionService = mock<CollectionService>();
adminConsoleCipherFormConfigService = mock<AdminConsoleCipherFormConfigService>();

// 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
TestBed.configureTestingModule({
@@ -51,8 +57,8 @@ describe("UnsecuredWebsitesReportComponent", () => {
useValue: accountService,
},
{
provide: ModalService,
useValue: mock<ModalService>(),
provide: DialogService,
useValue: mock<DialogService>(),
},
{
provide: PasswordRepromptService,
@@ -70,6 +76,14 @@ describe("UnsecuredWebsitesReportComponent", () => {
provide: CollectionService,
useValue: collectionService,
},
{
provide: CipherFormConfigService,
useValue: cipherFormConfigServiceMock,
},
{
provide: AdminConsoleCipherFormConfigService,
useValue: adminConsoleCipherFormConfigService,
},
],
schemas: [],
}).compileComponents();
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { Component, OnInit } from "@angular/core";

import { CollectionService, Collection } from "@bitwarden/admin-console/common";
import { ModalService } from "@bitwarden/angular/services/modal.service";
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";
import { CipherType } from "@bitwarden/common/vault/enums";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import { PasswordRepromptService } from "@bitwarden/vault";
import { DialogService } from "@bitwarden/components";
import { CipherFormConfigService, PasswordRepromptService } from "@bitwarden/vault";

import { AdminConsoleCipherFormConfigService } from "../../../vault/org-vault/services/admin-console-cipher-form-config.service";

import { CipherReportComponent } from "./cipher-report.component";

@@ -23,21 +25,25 @@ export class UnsecuredWebsitesReportComponent extends CipherReportComponent impl
constructor(
protected cipherService: CipherService,
protected organizationService: OrganizationService,
dialogService: DialogService,
accountService: AccountService,
modalService: ModalService,
passwordRepromptService: PasswordRepromptService,
i18nService: I18nService,
syncService: SyncService,
private collectionService: CollectionService,
cipherFormConfigService: CipherFormConfigService,
adminConsoleCipherFormConfigService: AdminConsoleCipherFormConfigService,
) {
super(
cipherService,
modalService,
dialogService,
passwordRepromptService,
organizationService,
accountService,
i18nService,
syncService,
cipherFormConfigService,
adminConsoleCipherFormConfigService,
);
}

Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@ import { mock, MockProxy } from "jest-mock-extended";
import { of } from "rxjs";

import { I18nPipe } from "@bitwarden/angular/platform/pipes/i18n.pipe";
import { ModalService } from "@bitwarden/angular/services/modal.service";
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
@@ -14,7 +13,10 @@ import { PasswordStrengthServiceAbstraction } from "@bitwarden/common/tools/pass
import { UserId } from "@bitwarden/common/types/guid";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";
import { PasswordRepromptService } from "@bitwarden/vault";
import { DialogService } from "@bitwarden/components";
import { CipherFormConfigService, PasswordRepromptService } from "@bitwarden/vault";

import { AdminConsoleCipherFormConfigService } from "../../../vault/org-vault/services/admin-console-cipher-form-config.service";

import { cipherData } from "./reports-ciphers.mock";
import { WeakPasswordsReportComponent } from "./weak-passwords-report.component";
@@ -25,10 +27,12 @@ describe("WeakPasswordsReportComponent", () => {
let passwordStrengthService: MockProxy<PasswordStrengthServiceAbstraction>;
let organizationService: MockProxy<OrganizationService>;
let syncServiceMock: MockProxy<SyncService>;
let adminConsoleCipherFormConfigServiceMock: MockProxy<AdminConsoleCipherFormConfigService>;
const userId = Utils.newGuid() as UserId;
const accountService: FakeAccountService = mockAccountServiceWith(userId);

beforeEach(() => {
let cipherFormConfigServiceMock: MockProxy<CipherFormConfigService>;
syncServiceMock = mock<SyncService>();
passwordStrengthService = mock<PasswordStrengthServiceAbstraction>();
organizationService = mock<OrganizationService>();
@@ -55,8 +59,8 @@ describe("WeakPasswordsReportComponent", () => {
useValue: accountService,
},
{
provide: ModalService,
useValue: mock<ModalService>(),
provide: DialogService,
useValue: mock<DialogService>(),
},
{
provide: PasswordRepromptService,
@@ -70,6 +74,15 @@ describe("WeakPasswordsReportComponent", () => {
provide: I18nService,
useValue: mock<I18nService>(),
},
{
provide: CipherFormConfigService,
useValue: cipherFormConfigServiceMock,
},

{
provide: AdminConsoleCipherFormConfigService,
useValue: adminConsoleCipherFormConfigServiceMock,
},
],
schemas: [],
}).compileComponents();
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@
// @ts-strict-ignore
import { Component, OnInit } from "@angular/core";

import { ModalService } from "@bitwarden/angular/services/modal.service";
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
@@ -12,8 +11,10 @@ import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.servi
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";
import { CipherType } from "@bitwarden/common/vault/enums";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import { BadgeVariant } from "@bitwarden/components";
import { PasswordRepromptService } from "@bitwarden/vault";
import { BadgeVariant, DialogService } from "@bitwarden/components";
import { CipherFormConfigService, PasswordRepromptService } from "@bitwarden/vault";

import { AdminConsoleCipherFormConfigService } from "../../../vault/org-vault/services/admin-console-cipher-form-config.service";

import { CipherReportComponent } from "./cipher-report.component";

@@ -33,20 +34,24 @@ export class WeakPasswordsReportComponent extends CipherReportComponent implemen
protected cipherService: CipherService,
protected passwordStrengthService: PasswordStrengthServiceAbstraction,
protected organizationService: OrganizationService,
dialogService: DialogService,
protected accountService: AccountService,
modalService: ModalService,
passwordRepromptService: PasswordRepromptService,
i18nService: I18nService,
syncService: SyncService,
cipherFormConfigService: CipherFormConfigService,
adminConsoleCipherFormConfigService: AdminConsoleCipherFormConfigService,
) {
super(
cipherService,
modalService,
dialogService,
passwordRepromptService,
organizationService,
accountService,
i18nService,
syncService,
cipherFormConfigService,
adminConsoleCipherFormConfigService,
);
}

14 changes: 14 additions & 0 deletions apps/web/src/app/tools/reports/reports.module.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import { CommonModule } from "@angular/common";
import { NgModule } from "@angular/core";

import { CipherFormConfigService, DefaultCipherFormConfigService } from "@bitwarden/vault";

Check warning on line 4 in apps/web/src/app/tools/reports/reports.module.ts

Codecov / codecov/patch

apps/web/src/app/tools/reports/reports.module.ts#L4

Added line #L4 was not covered by tests

import { HeaderModule } from "../../layouts/header/header.module";
import { SharedModule } from "../../shared";
import { OrganizationBadgeModule } from "../../vault/individual-vault/organization-badge/organization-badge.module";
import { PipesModule } from "../../vault/individual-vault/pipes/pipes.module";
import { RoutedVaultFilterBridgeService } from "../../vault/individual-vault/vault-filter/services/routed-vault-filter-bridge.service";
import { RoutedVaultFilterService } from "../../vault/individual-vault/vault-filter/services/routed-vault-filter.service";
import { AdminConsoleCipherFormConfigService } from "../../vault/org-vault/services/admin-console-cipher-form-config.service";

Check warning on line 12 in apps/web/src/app/tools/reports/reports.module.ts

Codecov / codecov/patch

apps/web/src/app/tools/reports/reports.module.ts#L10-L12

Added lines #L10 - L12 were not covered by tests

import { BreachReportComponent } from "./pages/breach-report.component";
import { ExposedPasswordsReportComponent } from "./pages/exposed-passwords-report.component";
@@ -37,5 +42,14 @@
UnsecuredWebsitesReportComponent,
WeakPasswordsReportComponent,
],
providers: [
{
provide: CipherFormConfigService,
useClass: DefaultCipherFormConfigService,
},
RoutedVaultFilterService,
AdminConsoleCipherFormConfigService,
RoutedVaultFilterBridgeService,
],
})
export class ReportsModule {}
Original file line number Diff line number Diff line change
@@ -90,7 +90,7 @@ export interface VaultItemDialogParams {
/**
* Function to restore a cipher from the trash.
*/
restore: (c: CipherView) => Promise<boolean>;
restore?: (c: CipherView) => Promise<boolean>;
}

export enum VaultItemDialogResult {
@@ -387,7 +387,7 @@ export class VaultItemDialogComponent implements OnInit, OnDestroy {
}

restore = async () => {
await this.params.restore(this.cipher);
await this.params.restore?.(this.cipher);
this.dialogRef.close(VaultItemDialogResult.Restored);
};

Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ import { CipherId } from "@bitwarden/common/types/guid";
import { DialogService } from "@bitwarden/components";
import { CipherAttachmentsComponent } from "@bitwarden/vault";

import { SharedModule } from "../../shared";
import { SharedModule } from "../../shared/shared.module";

export interface AttachmentsDialogParams {
cipherId: CipherId;