1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-21 18:53:29 +00:00

[PM-26352] drawers for activity cards (#16895)

* new drawer functions for crit apps

* logic for triggering the drawer functions in components

* cleanup unused logic and rename "navigation" to "action"
- ... since the click is now triggering the drawer instead of navigating to another tab/page

* null check for reportData in drawer methods

* use criticalReportResults$ to avoid duplicating logic

* use criticalReportResults$ to avoid dupe logic

* remove unused code
This commit is contained in:
Alex
2025-10-28 11:44:42 -04:00
committed by GitHub
parent bf66b5ac19
commit 2058c772ac
5 changed files with 97 additions and 38 deletions

View File

@@ -175,6 +175,65 @@ export class RiskInsightsDataService {
}
};
setDrawerForCriticalAtRiskMembers = async (invokerId: string = ""): Promise<void> => {
const { open, activeDrawerType, invokerId: currentInvokerId } = this.drawerDetailsSubject.value;
const shouldClose =
open && activeDrawerType === DrawerType.OrgAtRiskMembers && currentInvokerId === invokerId;
if (shouldClose) {
this.closeDrawer();
} else {
const reportResults = await firstValueFrom(this.criticalReportResults$);
if (!reportResults?.reportData) {
return;
}
// Generate at-risk member list from critical applications
const atRiskMemberDetails = getAtRiskMemberList(reportResults.reportData);
this.drawerDetailsSubject.next({
open: true,
invokerId,
activeDrawerType: DrawerType.OrgAtRiskMembers,
atRiskMemberDetails,
appAtRiskMembers: null,
atRiskAppDetails: null,
});
}
};
setDrawerForCriticalAtRiskApps = async (invokerId: string = ""): Promise<void> => {
const { open, activeDrawerType, invokerId: currentInvokerId } = this.drawerDetailsSubject.value;
const shouldClose =
open && activeDrawerType === DrawerType.OrgAtRiskApps && currentInvokerId === invokerId;
if (shouldClose) {
this.closeDrawer();
} else {
const reportResults = await firstValueFrom(this.criticalReportResults$);
if (!reportResults?.reportData) {
return;
}
// Filter critical applications for those with at-risk passwords
const criticalAtRiskApps = reportResults.reportData
.filter((app) => app.atRiskPasswordCount > 0)
.map((app) => ({
applicationName: app.applicationName,
atRiskPasswordCount: app.atRiskPasswordCount,
}));
this.drawerDetailsSubject.next({
open: true,
invokerId,
activeDrawerType: DrawerType.OrgAtRiskApps,
atRiskMemberDetails: [],
appAtRiskMembers: null,
atRiskAppDetails: criticalAtRiskApps,
});
}
};
// ------------------------------ Critical application methods --------------
saveCriticalApplications(selectedUrls: string[]) {
return this.orchestrator.saveCriticalApplications$(selectedUrls);