1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-10 21:33:27 +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 * total at risk members, application, and at risk application
* counts. Aggregated from all calculated applications * counts. Aggregated from all calculated applications
*/ */
export type ApplicationHealthReportSummary = { export type OrganizationReportSummary = {
totalMemberCount: number; totalMemberCount: number;
totalCriticalMemberCount: number;
totalAtRiskMemberCount: number; totalAtRiskMemberCount: number;
totalCriticalAtRiskMemberCount: number;
totalApplicationCount: number; totalApplicationCount: number;
totalCriticalApplicationCount: number;
totalAtRiskApplicationCount: number; totalAtRiskApplicationCount: number;
totalCriticalAtRiskApplicationCount: number;
newApplications: string[];
}; };
export type CriticalSummaryDetails = { export type CriticalSummaryDetails = {
@@ -138,7 +143,7 @@ export type PasswordHealthReportApplicationId = Opaque<string, "PasswordHealthRe
// -------------------- Risk Insights Report Models -------------------- // -------------------- Risk Insights Report Models --------------------
export interface RiskInsightsReportData { export interface RiskInsightsReportData {
data: ApplicationHealthReportDetailEnriched[]; data: ApplicationHealthReportDetailEnriched[];
summary: ApplicationHealthReportSummary; summary: OrganizationReportSummary;
} }
export interface RiskInsightsReport { export interface RiskInsightsReport {
organizationId: OrganizationId; organizationId: OrganizationId;
@@ -157,6 +162,6 @@ export type ReportResult = CipherView & {
export type ReportDetailsAndSummary = { export type ReportDetailsAndSummary = {
data: ApplicationHealthReportDetailEnriched[]; data: ApplicationHealthReportDetailEnriched[];
summary: ApplicationHealthReportSummary; summary: OrganizationReportSummary;
dateCreated: Date; dateCreated: Date;
}; };

View File

@@ -40,7 +40,7 @@ import {
} from "../models/password-health"; } from "../models/password-health";
import { import {
ApplicationHealthReportDetail, ApplicationHealthReportDetail,
ApplicationHealthReportSummary, OrganizationReportSummary,
AtRiskMemberDetail, AtRiskMemberDetail,
AtRiskApplicationDetail, AtRiskApplicationDetail,
RiskInsightsReportData, RiskInsightsReportData,
@@ -63,11 +63,16 @@ export class RiskInsightsReportService {
private riskInsightsReportSubject = new BehaviorSubject<ApplicationHealthReportDetail[]>([]); private riskInsightsReportSubject = new BehaviorSubject<ApplicationHealthReportDetail[]>([]);
riskInsightsReport$ = this.riskInsightsReportSubject.asObservable(); riskInsightsReport$ = this.riskInsightsReportSubject.asObservable();
private riskInsightsSummarySubject = new BehaviorSubject<ApplicationHealthReportSummary>({ private riskInsightsSummarySubject = new BehaviorSubject<OrganizationReportSummary>({
totalMemberCount: 0, totalMemberCount: 0,
totalAtRiskMemberCount: 0, totalAtRiskMemberCount: 0,
totalApplicationCount: 0, totalApplicationCount: 0,
totalAtRiskApplicationCount: 0, totalAtRiskApplicationCount: 0,
totalCriticalMemberCount: 0,
totalCriticalAtRiskMemberCount: 0,
totalCriticalApplicationCount: 0,
totalCriticalAtRiskApplicationCount: 0,
newApplications: [],
}); });
riskInsightsSummary$ = this.riskInsightsSummarySubject.asObservable(); riskInsightsSummary$ = this.riskInsightsSummarySubject.asObservable();
@@ -190,20 +195,24 @@ export class RiskInsightsReportService {
* @param reports The previously calculated application health report data * @param reports The previously calculated application health report data
* @returns A summary object containing report totals * @returns A summary object containing report totals
*/ */
generateApplicationsSummary( generateApplicationsSummary(reports: ApplicationHealthReportDetail[]): OrganizationReportSummary {
reports: ApplicationHealthReportDetail[],
): ApplicationHealthReportSummary {
const totalMembers = reports.flatMap((x) => x.memberDetails); const totalMembers = reports.flatMap((x) => x.memberDetails);
const uniqueMembers = getUniqueMembers(totalMembers); const uniqueMembers = getUniqueMembers(totalMembers);
const atRiskMembers = reports.flatMap((x) => x.atRiskMemberDetails); const atRiskMembers = reports.flatMap((x) => x.atRiskMemberDetails);
const uniqueAtRiskMembers = getUniqueMembers(atRiskMembers); const uniqueAtRiskMembers = getUniqueMembers(atRiskMembers);
// TODO: totalCriticalMemberCount, totalCriticalAtRiskMemberCount, totalCriticalApplicationCount, totalCriticalAtRiskApplicationCount, and newApplications will be handled with future logic implementation
return { return {
totalMemberCount: uniqueMembers.length, totalMemberCount: uniqueMembers.length,
totalCriticalMemberCount: 0,
totalAtRiskMemberCount: uniqueAtRiskMembers.length, totalAtRiskMemberCount: uniqueAtRiskMembers.length,
totalCriticalAtRiskMemberCount: 0,
totalApplicationCount: reports.length, totalApplicationCount: reports.length,
totalCriticalApplicationCount: 0,
totalAtRiskApplicationCount: reports.filter((app) => app.atRiskPasswordCount > 0).length, totalAtRiskApplicationCount: reports.filter((app) => app.atRiskPasswordCount > 0).length,
totalCriticalAtRiskApplicationCount: 0,
newApplications: [],
}; };
} }
@@ -237,6 +246,11 @@ export class RiskInsightsReportService {
totalAtRiskMemberCount: 0, totalAtRiskMemberCount: 0,
totalApplicationCount: 0, totalApplicationCount: 0,
totalAtRiskApplicationCount: 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"; } from "@bitwarden/bit-common/dirt/reports/risk-insights/models/password-health";
import { import {
ApplicationHealthReportDetail, ApplicationHealthReportDetail,
ApplicationHealthReportSummary, OrganizationReportSummary,
} from "@bitwarden/bit-common/dirt/reports/risk-insights/models/report-models"; } 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 { RiskInsightsEncryptionService } from "@bitwarden/bit-common/dirt/reports/risk-insights/services/risk-insights-encryption.service";
import { import {
@@ -69,11 +69,16 @@ export class AllApplicationsComponent implements OnInit {
protected organization = new Organization(); protected organization = new Organization();
noItemsIcon = Security; noItemsIcon = Security;
protected markingAsCritical = false; protected markingAsCritical = false;
protected applicationSummary: ApplicationHealthReportSummary = { protected applicationSummary: OrganizationReportSummary = {
totalMemberCount: 0, totalMemberCount: 0,
totalAtRiskMemberCount: 0, totalAtRiskMemberCount: 0,
totalApplicationCount: 0, totalApplicationCount: 0,
totalAtRiskApplicationCount: 0, totalAtRiskApplicationCount: 0,
totalCriticalMemberCount: 0,
totalCriticalAtRiskMemberCount: 0,
totalCriticalApplicationCount: 0,
totalCriticalAtRiskApplicationCount: 0,
newApplications: [],
}; };
destroyRef = inject(DestroyRef); destroyRef = inject(DestroyRef);

View File

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