diff --git a/bitwarden_license/bit-common/src/dirt/reports/risk-insights/services/risk-insights-data.service.ts b/bitwarden_license/bit-common/src/dirt/reports/risk-insights/services/risk-insights-data.service.ts index 779351aaa85..15216a1d7d4 100644 --- a/bitwarden_license/bit-common/src/dirt/reports/risk-insights/services/risk-insights-data.service.ts +++ b/bitwarden_license/bit-common/src/dirt/reports/risk-insights/services/risk-insights-data.service.ts @@ -16,6 +16,7 @@ import { } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; import { getUserId } from "@bitwarden/common/auth/services/account.service"; +import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { OrganizationId, UserId } from "@bitwarden/common/types/guid"; import { @@ -81,6 +82,7 @@ export class RiskInsightsDataService { private criticalAppsService: CriticalAppsService, private organizationService: OrganizationService, private reportService: RiskInsightsReportService, + private logService: LogService, ) {} async initialize(organizationId: OrganizationId) { @@ -107,14 +109,21 @@ export class RiskInsightsDataService { this.fetchLastReport(organizationId, userId); // Setup new report generation - this._runApplicationsReport().subscribe({ - next: (result) => { - this.isRunningReportSubject.next(false); - }, - error: () => { - this.errorSubject.next("Failed to save report"); - }, - }); + this._runApplicationsReport() + .pipe( + finalize(() => { + this.isRunningReportSubject.next(false); + }), + ) + .subscribe({ + next: (result) => { + this.logService.info("Risk insights report completed successfully", result); + }, + error: () => { + this.logService.error("Error when running risk insights report"); + this.errorSubject.next("Failed to save report"); + }, + }); } filterReportByCritical( diff --git a/bitwarden_license/bit-web/src/app/dirt/access-intelligence/access-intelligence.module.ts b/bitwarden_license/bit-web/src/app/dirt/access-intelligence/access-intelligence.module.ts index 8a9fc915bf3..8e4633ed6fd 100644 --- a/bitwarden_license/bit-web/src/app/dirt/access-intelligence/access-intelligence.module.ts +++ b/bitwarden_license/bit-web/src/app/dirt/access-intelligence/access-intelligence.module.ts @@ -17,6 +17,7 @@ import { OrganizationService } from "@bitwarden/common/admin-console/abstraction import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service"; import { KeyGenerationService } from "@bitwarden/common/platform/abstractions/key-generation.service"; +import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PasswordStrengthServiceAbstraction } from "@bitwarden/common/tools/password-strength/password-strength.service.abstraction"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; import { KeyService } from "@bitwarden/key-management"; @@ -57,7 +58,13 @@ import { RiskInsightsComponent } from "./risk-insights.component"; }, { provide: RiskInsightsDataService, - deps: [AccountService, CriticalAppsService, OrganizationService, RiskInsightsReportService], + deps: [ + AccountService, + CriticalAppsService, + OrganizationService, + RiskInsightsReportService, + LogService, + ], }, { provide: RiskInsightsEncryptionService,