mirror of
https://github.com/bitwarden/browser
synced 2026-02-04 10:43:47 +00:00
refactor(dirt): remove newApplications from OrganizationReportSummary
Removes redundant newApplications field from summary type and uses derived newApplications$ observable from orchestrator instead. **Changes:** - Remove newApplications from OrganizationReportSummary type definition - Remove dummy data array from RiskInsightsReportService.getApplicationsSummary() - Remove newApplications subscription from AllActivitiesService - Update AllActivityComponent to subscribe directly to dataService.newApplications$ **Why:** - Eliminates data redundancy (stored vs derived) - newApplications$ already computes from applicationData.reviewedDate === null - Single source of truth: applicationData is the source - Simplifies encrypted payload (less data in summary) - Better separation: stored data (counts) vs computed data (lists) **Impact:** - No functional changes - UI continues to display new applications correctly - Cleaner architecture with computed observable pattern
This commit is contained in:
@@ -55,7 +55,6 @@ export type OrganizationReportSummary = {
|
||||
totalCriticalMemberCount: number;
|
||||
totalCriticalAtRiskMemberCount: number;
|
||||
totalCriticalAtRiskApplicationCount: number;
|
||||
newApplications: string[];
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -56,23 +56,6 @@ export class RiskInsightsReportService {
|
||||
const atRiskMembers = reports.flatMap((x) => x.atRiskMemberDetails);
|
||||
const uniqueAtRiskMembers = getUniqueMembers(atRiskMembers);
|
||||
|
||||
// TODO: Replace with actual new applications detection logic (PM-26185)
|
||||
const dummyNewApplications = [
|
||||
"github.com",
|
||||
"google.com",
|
||||
"stackoverflow.com",
|
||||
"gitlab.com",
|
||||
"bitbucket.org",
|
||||
"npmjs.com",
|
||||
"docker.com",
|
||||
"aws.amazon.com",
|
||||
"azure.microsoft.com",
|
||||
"jenkins.io",
|
||||
"terraform.io",
|
||||
"kubernetes.io",
|
||||
"atlassian.net",
|
||||
];
|
||||
|
||||
return {
|
||||
totalMemberCount: uniqueMembers.length,
|
||||
totalAtRiskMemberCount: uniqueAtRiskMembers.length,
|
||||
@@ -82,7 +65,6 @@ export class RiskInsightsReportService {
|
||||
totalCriticalAtRiskMemberCount: 0,
|
||||
totalCriticalApplicationCount: 0,
|
||||
totalCriticalAtRiskApplicationCount: 0,
|
||||
newApplications: dummyNewApplications,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ export class AllActivitiesService {
|
||||
totalCriticalApplicationCount: 0,
|
||||
totalAtRiskApplicationCount: 0,
|
||||
totalCriticalAtRiskApplicationCount: 0,
|
||||
newApplications: [],
|
||||
});
|
||||
reportSummary$ = this.reportSummarySubject$.asObservable();
|
||||
|
||||
@@ -54,11 +53,6 @@ export class AllActivitiesService {
|
||||
this.setCriticalAppsReportSummary(report.summaryData);
|
||||
}
|
||||
});
|
||||
|
||||
// New applications changes (from orchestrator's reactive pipeline)
|
||||
this.dataService.newApplications$.pipe(takeUntilDestroyed()).subscribe((newApps) => {
|
||||
this.setNewApplications(newApps);
|
||||
});
|
||||
}
|
||||
|
||||
setCriticalAppsReportSummary(summary: OrganizationReportSummary) {
|
||||
@@ -78,7 +72,6 @@ export class AllActivitiesService {
|
||||
totalAtRiskMemberCount: summary.totalAtRiskMemberCount,
|
||||
totalApplicationCount: summary.totalApplicationCount,
|
||||
totalAtRiskApplicationCount: summary.totalAtRiskApplicationCount,
|
||||
// Note: newApplications now set separately via newApplications$ subscription
|
||||
});
|
||||
}
|
||||
|
||||
@@ -98,15 +91,4 @@ export class AllActivitiesService {
|
||||
setTaskCreatedCount(count: number) {
|
||||
this.taskCreatedCountSubject$.next(count);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the newApplications list in the report summary.
|
||||
* Called when the orchestrator's newApplications$ observable emits.
|
||||
*/
|
||||
private setNewApplications(newApps: string[]) {
|
||||
this.reportSummarySubject$.next({
|
||||
...this.reportSummarySubject$.getValue(),
|
||||
newApplications: newApps,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,8 +69,13 @@ export class AllActivityComponent implements OnInit {
|
||||
this.totalCriticalAppsAtRiskMemberCount = summary.totalCriticalAtRiskMemberCount;
|
||||
this.totalCriticalAppsCount = summary.totalCriticalApplicationCount;
|
||||
this.totalCriticalAppsAtRiskCount = summary.totalCriticalAtRiskApplicationCount;
|
||||
this.newApplications = summary.newApplications;
|
||||
this.newApplicationsCount = summary.newApplications.length;
|
||||
});
|
||||
|
||||
this.dataService.newApplications$
|
||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||
.subscribe((newApps) => {
|
||||
this.newApplications = newApps;
|
||||
this.newApplicationsCount = newApps.length;
|
||||
});
|
||||
|
||||
this.allActivitiesService.passwordChangeProgressMetricHasProgressBar$
|
||||
|
||||
Reference in New Issue
Block a user