1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-12 22:33:35 +00:00

PM-17783 highlight when drawers are open (#13293)

This commit is contained in:
Vijay Oommen
2025-02-07 10:11:17 -06:00
committed by GitHub
parent dd55086cbb
commit 00b19cf577
6 changed files with 57 additions and 19 deletions

View File

@@ -28,6 +28,7 @@ export class RiskInsightsDataService {
dataLastUpdated$ = this.dataLastUpdatedSubject.asObservable(); dataLastUpdated$ = this.dataLastUpdatedSubject.asObservable();
openDrawer = false; openDrawer = false;
drawerInvokerId: string = "";
activeDrawerType: DrawerType = DrawerType.None; activeDrawerType: DrawerType = DrawerType.None;
atRiskMemberDetails: AtRiskMemberDetail[] = []; atRiskMemberDetails: AtRiskMemberDetail[] = [];
appAtRiskMembers: AppAtRiskMembersDialogParams | null = null; appAtRiskMembers: AppAtRiskMembersDialogParams | null = null;
@@ -73,25 +74,35 @@ export class RiskInsightsDataService {
return this.activeDrawerType === drawerType; return this.activeDrawerType === drawerType;
}; };
setDrawerForOrgAtRiskMembers = (atRiskMemberDetails: AtRiskMemberDetail[]): void => { setDrawerForOrgAtRiskMembers = (
atRiskMemberDetails: AtRiskMemberDetail[],
invokerId: string = "",
): void => {
this.resetDrawer(DrawerType.OrgAtRiskMembers); this.resetDrawer(DrawerType.OrgAtRiskMembers);
this.activeDrawerType = DrawerType.OrgAtRiskMembers; this.activeDrawerType = DrawerType.OrgAtRiskMembers;
this.drawerInvokerId = invokerId;
this.atRiskMemberDetails = atRiskMemberDetails; this.atRiskMemberDetails = atRiskMemberDetails;
this.openDrawer = !this.openDrawer; this.openDrawer = !this.openDrawer;
}; };
setDrawerForAppAtRiskMembers = ( setDrawerForAppAtRiskMembers = (
atRiskMembersDialogParams: AppAtRiskMembersDialogParams, atRiskMembersDialogParams: AppAtRiskMembersDialogParams,
invokerId: string = "",
): void => { ): void => {
this.resetDrawer(DrawerType.None); this.resetDrawer(DrawerType.None);
this.activeDrawerType = DrawerType.AppAtRiskMembers; this.activeDrawerType = DrawerType.AppAtRiskMembers;
this.drawerInvokerId = invokerId;
this.appAtRiskMembers = atRiskMembersDialogParams; this.appAtRiskMembers = atRiskMembersDialogParams;
this.openDrawer = !this.openDrawer; this.openDrawer = !this.openDrawer;
}; };
setDrawerForOrgAtRiskApps = (atRiskApps: AtRiskApplicationDetail[]): void => { setDrawerForOrgAtRiskApps = (
atRiskApps: AtRiskApplicationDetail[],
invokerId: string = "",
): void => {
this.resetDrawer(DrawerType.OrgAtRiskApps); this.resetDrawer(DrawerType.OrgAtRiskApps);
this.activeDrawerType = DrawerType.OrgAtRiskApps; this.activeDrawerType = DrawerType.OrgAtRiskApps;
this.drawerInvokerId = invokerId;
this.atRiskAppDetails = atRiskApps; this.atRiskAppDetails = atRiskApps;
this.openDrawer = !this.openDrawer; this.openDrawer = !this.openDrawer;
}; };
@@ -109,5 +120,6 @@ export class RiskInsightsDataService {
this.atRiskMemberDetails = []; this.atRiskMemberDetails = [];
this.appAtRiskMembers = null; this.appAtRiskMembers = null;
this.atRiskAppDetails = null; this.atRiskAppDetails = null;
this.drawerInvokerId = "";
}; };
} }

View File

@@ -27,19 +27,25 @@
<h2 class="tw-mb-6" bitTypography="h2">{{ "allApplications" | i18n }}</h2> <h2 class="tw-mb-6" bitTypography="h2">{{ "allApplications" | i18n }}</h2>
<div class="tw-flex tw-gap-6"> <div class="tw-flex tw-gap-6">
<tools-card <tools-card
#allAppsOrgAtRiskMembers
class="tw-flex-1 tw-cursor-pointer" class="tw-flex-1 tw-cursor-pointer"
[ngClass]="{ 'tw-bg-primary-100': dataService.drawerInvokerId === 'allAppsOrgAtRiskMembers' }"
[title]="'atRiskMembers' | i18n" [title]="'atRiskMembers' | i18n"
[value]="applicationSummary.totalAtRiskMemberCount" [value]="applicationSummary.totalAtRiskMemberCount"
[maxValue]="applicationSummary.totalMemberCount" [maxValue]="applicationSummary.totalMemberCount"
(click)="showOrgAtRiskMembers()" (click)="showOrgAtRiskMembers('allAppsOrgAtRiskMembers')"
> >
</tools-card> </tools-card>
<tools-card <tools-card
#allAppsOrgAtRiskApplications
class="tw-flex-1 tw-cursor-pointer" class="tw-flex-1 tw-cursor-pointer"
[ngClass]="{
'tw-bg-primary-100': dataService.drawerInvokerId === 'allAppsOrgAtRiskApplications',
}"
[title]="'atRiskApplications' | i18n" [title]="'atRiskApplications' | i18n"
[value]="applicationSummary.totalAtRiskApplicationCount" [value]="applicationSummary.totalAtRiskApplicationCount"
[maxValue]="applicationSummary.totalApplicationCount" [maxValue]="applicationSummary.totalApplicationCount"
(click)="showOrgAtRiskApps()" (click)="showOrgAtRiskApps('allAppsOrgAtRiskApplications')"
> >
</tools-card> </tools-card>
</div> </div>
@@ -75,7 +81,11 @@
</tr> </tr>
</ng-container> </ng-container>
<ng-template body let-rows$> <ng-template body let-rows$>
<tr bitRow *ngFor="let r of rows$ | async; trackBy: trackByFunction"> <tr
bitRow
*ngFor="let r of rows$ | async; trackBy: trackByFunction"
[ngClass]="{ 'tw-bg-primary-100': dataService.drawerInvokerId === r.applicationName }"
>
<td *ngIf="isCriticalAppsFeatureEnabled"> <td *ngIf="isCriticalAppsFeatureEnabled">
<input <input
bitCheckbox bitCheckbox

View File

@@ -177,17 +177,17 @@ export class AllApplicationsComponent implements OnInit {
?.atRiskMemberDetails ?? [], ?.atRiskMemberDetails ?? [],
applicationName, applicationName,
}; };
this.dataService.setDrawerForAppAtRiskMembers(info); this.dataService.setDrawerForAppAtRiskMembers(info, applicationName);
}; };
showOrgAtRiskMembers = async () => { showOrgAtRiskMembers = async (invokerId: string) => {
const dialogData = this.reportService.generateAtRiskMemberList(this.dataSource.data); const dialogData = this.reportService.generateAtRiskMemberList(this.dataSource.data);
this.dataService.setDrawerForOrgAtRiskMembers(dialogData); this.dataService.setDrawerForOrgAtRiskMembers(dialogData, invokerId);
}; };
showOrgAtRiskApps = async () => { showOrgAtRiskApps = async (invokerId: string) => {
const data = this.reportService.generateAtRiskApplicationList(this.dataSource.data); const data = this.reportService.generateAtRiskApplicationList(this.dataSource.data);
this.dataService.setDrawerForOrgAtRiskApps(data); this.dataService.setDrawerForOrgAtRiskApps(data, invokerId);
}; };
onCheckboxChange(applicationName: string, event: Event) { onCheckboxChange(applicationName: string, event: Event) {

View File

@@ -35,19 +35,27 @@
</div> </div>
<div class="tw-flex tw-gap-6"> <div class="tw-flex tw-gap-6">
<tools-card <tools-card
#criticalAppsAtRiskMembers
class="tw-flex-1 tw-cursor-pointer" class="tw-flex-1 tw-cursor-pointer"
[ngClass]="{
'tw-bg-primary-100': dataService.drawerInvokerId === 'criticalAppsAtRiskMembers',
}"
[title]="'atRiskMembers' | i18n" [title]="'atRiskMembers' | i18n"
[value]="applicationSummary.totalAtRiskMemberCount" [value]="applicationSummary.totalAtRiskMemberCount"
[maxValue]="applicationSummary.totalMemberCount" [maxValue]="applicationSummary.totalMemberCount"
(click)="showOrgAtRiskMembers()" (click)="showOrgAtRiskMembers('criticalAppsAtRiskMembers')"
> >
</tools-card> </tools-card>
<tools-card <tools-card
#criticalAppsAtRiskApplications
class="tw-flex-1 tw-cursor-pointer" class="tw-flex-1 tw-cursor-pointer"
[ngClass]="{
'tw-bg-primary-100': dataService.drawerInvokerId === 'criticalAppsAtRiskApplications',
}"
[title]="'atRiskApplications' | i18n" [title]="'atRiskApplications' | i18n"
[value]="applicationSummary.totalAtRiskApplicationCount" [value]="applicationSummary.totalAtRiskApplicationCount"
[maxValue]="applicationSummary.totalApplicationCount" [maxValue]="applicationSummary.totalApplicationCount"
(click)="showOrgAtRiskApps()" (click)="showOrgAtRiskApps('criticalAppsAtRiskApplications')"
> >
</tools-card> </tools-card>
</div> </div>
@@ -70,7 +78,11 @@
</tr> </tr>
</ng-container> </ng-container>
<ng-template body let-rows$> <ng-template body let-rows$>
<tr bitRow *ngFor="let r of rows$ | async; trackBy: trackByFunction"> <tr
bitRow
*ngFor="let r of rows$ | async; trackBy: trackByFunction"
[ngClass]="{ 'tw-bg-primary-100': dataService.drawerInvokerId === r.applicationName }"
>
<td> <td>
<i class="bwi bwi-star-f" *ngIf="r.isMarkedAsCritical"></i> <i class="bwi bwi-star-f" *ngIf="r.isMarkedAsCritical"></i>
</td> </td>

View File

@@ -131,17 +131,17 @@ export class CriticalApplicationsComponent implements OnInit {
?.atRiskMemberDetails ?? [], ?.atRiskMemberDetails ?? [],
applicationName, applicationName,
}; };
this.dataService.setDrawerForAppAtRiskMembers(data); this.dataService.setDrawerForAppAtRiskMembers(data, applicationName);
}; };
showOrgAtRiskMembers = async () => { showOrgAtRiskMembers = async (invokerId: string) => {
const data = this.reportService.generateAtRiskMemberList(this.dataSource.data); const data = this.reportService.generateAtRiskMemberList(this.dataSource.data);
this.dataService.setDrawerForOrgAtRiskMembers(data); this.dataService.setDrawerForOrgAtRiskMembers(data, invokerId);
}; };
showOrgAtRiskApps = async () => { showOrgAtRiskApps = async (invokerId: string) => {
const data = this.reportService.generateAtRiskApplicationList(this.dataSource.data); const data = this.reportService.generateAtRiskApplicationList(this.dataSource.data);
this.dataService.setDrawerForOrgAtRiskApps(data); this.dataService.setDrawerForOrgAtRiskApps(data, invokerId);
}; };
trackByFunction(_: number, item: ApplicationHealthReportDetailWithCriticalFlag) { trackByFunction(_: number, item: ApplicationHealthReportDetailWithCriticalFlag) {

View File

@@ -56,7 +56,11 @@
</bit-tab> </bit-tab>
</bit-tab-group> </bit-tab-group>
<bit-drawer style="width: 30%" [(open)]="dataService.openDrawer"> <bit-drawer
style="width: 30%"
[(open)]="dataService.openDrawer"
(openChange)="dataService.closeDrawer()"
>
<ng-container *ngIf="dataService.isActiveDrawerType(drawerTypes.OrgAtRiskMembers)"> <ng-container *ngIf="dataService.isActiveDrawerType(drawerTypes.OrgAtRiskMembers)">
<bit-drawer-header <bit-drawer-header
title="{{ 'atRiskMembersWithCount' | i18n: dataService.atRiskMemberDetails.length }}" title="{{ 'atRiskMembersWithCount' | i18n: dataService.atRiskMemberDetails.length }}"