1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-04 18:53:20 +00:00

- use finalize() to prevent infinite loading wheel on run report non success responses

- log service
This commit is contained in:
Alex
2025-09-11 12:30:33 -04:00
parent c947041f74
commit 26da146b08
2 changed files with 25 additions and 9 deletions

View File

@@ -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(

View File

@@ -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,