1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-06 00:13:28 +00:00

[PM-25838] Adding new properties to the summary and renaming the type (#16477)

* Adding new properties to the summary and renaming the type

* properties were missing from not saving

* fixing type issues and missed renaming
This commit is contained in:
Tom
2025-09-18 16:18:41 -04:00
committed by GitHub
parent b091719748
commit d4cf7217e3
4 changed files with 36 additions and 12 deletions

View File

@@ -90,11 +90,16 @@ export type CipherApplicationView = {
* total at risk members, application, and at risk application
* counts. Aggregated from all calculated applications
*/
export type ApplicationHealthReportSummary = {
export type OrganizationReportSummary = {
totalMemberCount: number;
totalCriticalMemberCount: number;
totalAtRiskMemberCount: number;
totalCriticalAtRiskMemberCount: number;
totalApplicationCount: number;
totalCriticalApplicationCount: number;
totalAtRiskApplicationCount: number;
totalCriticalAtRiskApplicationCount: number;
newApplications: string[];
};
export type CriticalSummaryDetails = {
@@ -138,7 +143,7 @@ export type PasswordHealthReportApplicationId = Opaque<string, "PasswordHealthRe
// -------------------- Risk Insights Report Models --------------------
export interface RiskInsightsReportData {
data: ApplicationHealthReportDetailEnriched[];
summary: ApplicationHealthReportSummary;
summary: OrganizationReportSummary;
}
export interface RiskInsightsReport {
organizationId: OrganizationId;
@@ -157,6 +162,6 @@ export type ReportResult = CipherView & {
export type ReportDetailsAndSummary = {
data: ApplicationHealthReportDetailEnriched[];
summary: ApplicationHealthReportSummary;
summary: OrganizationReportSummary;
dateCreated: Date;
};

View File

@@ -40,7 +40,7 @@ import {
} from "../models/password-health";
import {
ApplicationHealthReportDetail,
ApplicationHealthReportSummary,
OrganizationReportSummary,
AtRiskMemberDetail,
AtRiskApplicationDetail,
RiskInsightsReportData,
@@ -63,11 +63,16 @@ export class RiskInsightsReportService {
private riskInsightsReportSubject = new BehaviorSubject<ApplicationHealthReportDetail[]>([]);
riskInsightsReport$ = this.riskInsightsReportSubject.asObservable();
private riskInsightsSummarySubject = new BehaviorSubject<ApplicationHealthReportSummary>({
private riskInsightsSummarySubject = new BehaviorSubject<OrganizationReportSummary>({
totalMemberCount: 0,
totalAtRiskMemberCount: 0,
totalApplicationCount: 0,
totalAtRiskApplicationCount: 0,
totalCriticalMemberCount: 0,
totalCriticalAtRiskMemberCount: 0,
totalCriticalApplicationCount: 0,
totalCriticalAtRiskApplicationCount: 0,
newApplications: [],
});
riskInsightsSummary$ = this.riskInsightsSummarySubject.asObservable();
@@ -190,20 +195,24 @@ export class RiskInsightsReportService {
* @param reports The previously calculated application health report data
* @returns A summary object containing report totals
*/
generateApplicationsSummary(
reports: ApplicationHealthReportDetail[],
): ApplicationHealthReportSummary {
generateApplicationsSummary(reports: ApplicationHealthReportDetail[]): OrganizationReportSummary {
const totalMembers = reports.flatMap((x) => x.memberDetails);
const uniqueMembers = getUniqueMembers(totalMembers);
const atRiskMembers = reports.flatMap((x) => x.atRiskMemberDetails);
const uniqueAtRiskMembers = getUniqueMembers(atRiskMembers);
// TODO: totalCriticalMemberCount, totalCriticalAtRiskMemberCount, totalCriticalApplicationCount, totalCriticalAtRiskApplicationCount, and newApplications will be handled with future logic implementation
return {
totalMemberCount: uniqueMembers.length,
totalCriticalMemberCount: 0,
totalAtRiskMemberCount: uniqueAtRiskMembers.length,
totalCriticalAtRiskMemberCount: 0,
totalApplicationCount: reports.length,
totalCriticalApplicationCount: 0,
totalAtRiskApplicationCount: reports.filter((app) => app.atRiskPasswordCount > 0).length,
totalCriticalAtRiskApplicationCount: 0,
newApplications: [],
};
}
@@ -237,6 +246,11 @@ export class RiskInsightsReportService {
totalAtRiskMemberCount: 0,
totalApplicationCount: 0,
totalAtRiskApplicationCount: 0,
totalCriticalMemberCount: 0,
totalCriticalAtRiskMemberCount: 0,
totalCriticalApplicationCount: 0,
totalCriticalAtRiskApplicationCount: 0,
newApplications: [],
},
});
}

View File

@@ -16,7 +16,7 @@ import {
} from "@bitwarden/bit-common/dirt/reports/risk-insights/models/password-health";
import {
ApplicationHealthReportDetail,
ApplicationHealthReportSummary,
OrganizationReportSummary,
} from "@bitwarden/bit-common/dirt/reports/risk-insights/models/report-models";
import { RiskInsightsEncryptionService } from "@bitwarden/bit-common/dirt/reports/risk-insights/services/risk-insights-encryption.service";
import {
@@ -69,11 +69,16 @@ export class AllApplicationsComponent implements OnInit {
protected organization = new Organization();
noItemsIcon = Security;
protected markingAsCritical = false;
protected applicationSummary: ApplicationHealthReportSummary = {
protected applicationSummary: OrganizationReportSummary = {
totalMemberCount: 0,
totalAtRiskMemberCount: 0,
totalApplicationCount: 0,
totalAtRiskApplicationCount: 0,
totalCriticalMemberCount: 0,
totalCriticalAtRiskMemberCount: 0,
totalCriticalApplicationCount: 0,
totalCriticalAtRiskApplicationCount: 0,
newApplications: [],
};
destroyRef = inject(DestroyRef);

View File

@@ -16,7 +16,7 @@ import {
LEGACY_ApplicationHealthReportDetailWithCriticalFlag,
LEGACY_ApplicationHealthReportDetailWithCriticalFlagAndCipher,
} from "@bitwarden/bit-common/dirt/reports/risk-insights/models/password-health";
import { ApplicationHealthReportSummary } from "@bitwarden/bit-common/dirt/reports/risk-insights/models/report-models";
import { OrganizationReportSummary } from "@bitwarden/bit-common/dirt/reports/risk-insights/models/report-models";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { getUserId } from "@bitwarden/common/auth/services/account.service";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
@@ -57,7 +57,7 @@ export class CriticalApplicationsComponent implements OnInit {
private destroyRef = inject(DestroyRef);
protected loading = false;
protected organizationId: OrganizationId;
protected applicationSummary = {} as ApplicationHealthReportSummary;
protected applicationSummary = {} as OrganizationReportSummary;
noItemsIcon = Security;
enableRequestPasswordChange = false;