Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,37 @@ 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.reportResults$);
if (!reportResults) {
return;
}

// Get enriched data that includes critical app status
const enrichedData = await firstValueFrom(this.enrichReportData$(reportResults.reportData));

// Filter for critical applications only, then generate at-risk member list
const criticalApps = enrichedData.filter((app) => app.isMarkedAsCritical);
const atRiskMemberDetails = this.reportService.generateAtRiskMemberList(criticalApps);

this.drawerDetailsSubject.next({
open: true,
invokerId,
activeDrawerType: DrawerType.OrgAtRiskMembers,
atRiskMemberDetails,
appAtRiskMembers: null,
atRiskAppDetails: null,
});
}
};

setDrawerForAppAtRiskMembers = async (invokerId: string = ""): Promise<void> => {
const { open, activeDrawerType, invokerId: currentInvokerId } = this.drawerDetailsSubject.value;
const shouldClose =
Expand Down Expand Up @@ -328,6 +359,41 @@ export class RiskInsightsDataService {
}
};

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.reportResults$);
if (!reportResults) {
return;
}

// Get enriched data that includes critical app status
const enrichedData = await firstValueFrom(this.enrichReportData$(reportResults.reportData));

// Filter for critical applications that have at-risk passwords
const criticalAtRiskApps = enrichedData
.filter((app) => app.isMarkedAsCritical && 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,
});
}
};

// ------------------- Trigger Report Generation -------------------
/** Trigger generating a report based on the current applications */
triggerReport(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
</button>
</div>
}
@if (showNavigationLink && !buttonText) {
@if (showActionLink && !buttonText) {
<div class="tw-flex tw-items-baseline tw-mt-4 tw-gap-2">
<p bitTypography="body1">
<a bitLink (click)="navigateToLink(navigationLink)" rel="noreferrer">
{{ navigationText }}
<a bitLink href="#" (click)="onActionClick(); $event.preventDefault()" rel="noreferrer">
{{ actionText }}
</a>
</p>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,14 @@ export class ActivityCardComponent {
@Input() metricDescription: string = "";

/**
* The link to navigate to for more information
* The text to display for the action link
*/
@Input() navigationLink: string = "";
@Input() actionText: string = "";

/**
* The text to display for the navigation link
* Show action link
*/
@Input() navigationText: string = "";

/**
* Show Navigation link
*/
@Input() showNavigationLink: boolean = false;
@Input() showActionLink: boolean = false;

/**
* Icon class to display next to metrics (e.g., "bwi-exclamation-triangle").
Expand All @@ -64,13 +59,18 @@ export class ActivityCardComponent {
*/
@Output() buttonClick = new EventEmitter<void>();

constructor(private router: Router) {}
/**
* Event emitted when action link is clicked
*/
@Output() actionClick = new EventEmitter<void>();

navigateToLink = async (navigationLink: string) => {
await this.router.navigateByUrl(navigationLink);
};
constructor(private router: Router) {}

onButtonClick = () => {
this.buttonClick.emit();
};

onActionClick = () => {
this.actionClick.emit();
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
[title]="'atRiskMembers' | i18n"
[cardMetrics]="'membersAtRiskCount' | i18n: totalCriticalAppsAtRiskMemberCount"
[metricDescription]="'membersWithAccessToAtRiskItemsForCriticalApps' | i18n"
navigationText="{{ 'viewAtRiskMembers' | i18n }}"
navigationLink="{{ getLinkForRiskInsightsTab(RiskInsightsTabType.AllApps) }}"
[showNavigationLink]="totalCriticalAppsAtRiskMemberCount > 0"
actionText="{{ 'viewAtRiskMembers' | i18n }}"
[showActionLink]="totalCriticalAppsAtRiskMemberCount > 0"
(actionClick)="onViewAtRiskMembers()"
>
</dirt-activity-card>
</li>
Expand All @@ -35,9 +35,9 @@
: ('criticalApplicationsAreAtRisk'
| i18n: totalCriticalAppsAtRiskCount : totalCriticalAppsCount)
"
navigationText="{{ 'viewAtRiskApplications' | i18n }}"
navigationLink="{{ getLinkForRiskInsightsTab(RiskInsightsTabType.CriticalApps) }}"
[showNavigationLink]="totalCriticalAppsAtRiskCount > 0"
actionText="{{ 'viewAtRiskApplications' | i18n }}"
[showActionLink]="totalCriticalAppsAtRiskCount > 0"
(actionClick)="onViewAtRiskApplications()"
>
</dirt-activity-card>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,20 @@ export class AllActivityComponent implements OnInit {

await firstValueFrom(dialogRef.closed);
};

/**
* Handles the "View at-risk members" link click.
* Opens the at-risk members drawer for critical applications only.
*/
onViewAtRiskMembers = async () => {
await this.dataService.setDrawerForCriticalAtRiskMembers("activityTabAtRiskMembers");
};

/**
* Handles the "View at-risk applications" link click.
* Opens the at-risk applications drawer for critical applications only.
*/
onViewAtRiskApplications = async () => {
await this.dataService.setDrawerForCriticalAtRiskApps("activityTabAtRiskApplications");
};
}
Loading