From 170021491e625df50ec94c4bc0c1c5fb9cdccaab Mon Sep 17 00:00:00 2001 From: jordan-bite Date: Tue, 2 Jul 2024 17:18:09 -0700 Subject: [PATCH] WIP - migrate exposed passwords report components --- .../reports/pages/cipher-report.component.ts | 5 ++ .../exposed-passwords-report.component.html | 51 +++++++++---------- .../exposed-passwords-report.component.ts | 6 ++- .../tools/reports/reports-routing.module.ts | 12 ++--- 4 files changed, 40 insertions(+), 34 deletions(-) diff --git a/apps/web/src/app/tools/reports/pages/cipher-report.component.ts b/apps/web/src/app/tools/reports/pages/cipher-report.component.ts index 4e63dd5cc96..b6a34cf2518 100644 --- a/apps/web/src/app/tools/reports/pages/cipher-report.component.ts +++ b/apps/web/src/app/tools/reports/pages/cipher-report.component.ts @@ -9,6 +9,7 @@ import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.servi 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"; @@ -24,6 +25,7 @@ export class CipherReportComponent implements OnDestroy { hasLoaded = false; ciphers: CipherView[] = []; allCiphers: CipherView[] = []; + dataSource = new TableDataSource(); organization: Organization; organizations: Organization[]; organizations$: Observable; @@ -104,6 +106,7 @@ export class CipherReportComponent implements OnDestroy { } else { this.ciphers = this.ciphers.filter((c: any) => c.orgFilterStatus === status); } + this.dataSource.data = this.ciphers; } async load() { @@ -193,6 +196,8 @@ export class CipherReportComponent implements OnDestroy { return ciph; }); + this.dataSource.data = this.ciphers; + if (this.filterStatus.length > 2) { this.showFilterToggle = true; this.vaultMsg = "vaults"; diff --git a/apps/web/src/app/tools/reports/pages/exposed-passwords-report.component.html b/apps/web/src/app/tools/reports/pages/exposed-passwords-report.component.html index 30801a42fdc..5bbe4a1e702 100644 --- a/apps/web/src/app/tools/reports/pages/exposed-passwords-report.component.html +++ b/apps/web/src/app/tools/reports/pages/exposed-passwords-report.component.html @@ -6,13 +6,13 @@ {{ "checkExposedPasswords" | i18n }}
- + {{ "noExposedPasswords" | i18n }} - + - + {{ "exposedPasswordsFoundReportDesc" | i18n: (ciphers.length | number) : vaultMsg }} - + - - + + - - - - + - - -
{{ "name" | i18n }} {{ "owner" | i18n }}
- + + +
+ - + + {{ c.name }}{{ r.name }} - {{ c.name }} + {{ r.name }} - + {{ "shared" | i18n }} - + {{ "attachments" | i18n }}
- {{ c.subTitle }} + {{ r.subTitle }}
- {{ "exposedXTimes" | i18n: (exposedPasswordMap.get(c.id) | number) }} + {{ "exposedXTimes" | i18n: (exposedPasswordMap.get(r.id) | number) }}
+ +
diff --git a/apps/web/src/app/tools/reports/pages/exposed-passwords-report.component.ts b/apps/web/src/app/tools/reports/pages/exposed-passwords-report.component.ts index cabc7bdfa12..cd908cfcf9e 100644 --- a/apps/web/src/app/tools/reports/pages/exposed-passwords-report.component.ts +++ b/apps/web/src/app/tools/reports/pages/exposed-passwords-report.component.ts @@ -11,6 +11,8 @@ import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { PasswordRepromptService } from "@bitwarden/vault"; import { CipherReportComponent } from "./cipher-report.component"; +import { cipherData } from "./reports-ciphers.mock"; + @Component({ selector: "app-exposed-passwords-report", @@ -44,7 +46,9 @@ export class ExposedPasswordsReportComponent extends CipherReportComponent imple } async setCiphers() { - const allCiphers = await this.getAllCiphers(); + const allCiphers = cipherData; + // const allCiphers = await this.getAllCiphers(); + this.dataSource.data = allCiphers; const exposedPasswordCiphers: CipherView[] = []; const promises: Promise[] = []; this.filterStatus = [0]; diff --git a/apps/web/src/app/tools/reports/reports-routing.module.ts b/apps/web/src/app/tools/reports/reports-routing.module.ts index 0733a57564b..2ab8e931f25 100644 --- a/apps/web/src/app/tools/reports/reports-routing.module.ts +++ b/apps/web/src/app/tools/reports/reports-routing.module.ts @@ -3,7 +3,7 @@ import { RouterModule, Routes } from "@angular/router"; import { AuthGuard } from "@bitwarden/angular/auth/guards"; -import { hasPremiumGuard } from "../../core/guards/has-premium.guard"; +// import { hasPremiumGuard } from "../../core/guards/has-premium.guard"; import { BreachReportComponent } from "./pages/breach-report.component"; import { ExposedPasswordsReportComponent } from "./pages/exposed-passwords-report.component"; @@ -35,31 +35,31 @@ const routes: Routes = [ path: "reused-passwords-report", component: ReusedPasswordsReportComponent, data: { titleId: "reusedPasswordsReport" }, - canActivate: [hasPremiumGuard()], + // canActivate: [hasPremiumGuard()], }, { path: "unsecured-websites-report", component: UnsecuredWebsitesReportComponent, data: { titleId: "unsecuredWebsitesReport" }, - canActivate: [hasPremiumGuard()], + // canActivate: [hasPremiumGuard()], }, { path: "weak-passwords-report", component: WeakPasswordsReportComponent, data: { titleId: "weakPasswordsReport" }, - canActivate: [hasPremiumGuard()], + // canActivate: [hasPremiumGuard()], }, { path: "exposed-passwords-report", component: ExposedPasswordsReportComponent, data: { titleId: "exposedPasswordsReport" }, - canActivate: [hasPremiumGuard()], + // canActivate: [hasPremiumGuard()], }, { path: "inactive-two-factor-report", component: InactiveTwoFactorReportComponent, data: { titleId: "inactive2faReport" }, - canActivate: [hasPremiumGuard()], + // canActivate: [hasPremiumGuard()], }, ], },