mirror of
https://github.com/bitwarden/browser
synced 2025-12-10 13:23:34 +00:00
* Add password trigger logic to report service. Also updated api to use classes that properly handle encstring with placeholders for upcoming usage * Fix merged test case conflict * Fix type errors and test cases. Make create data functions for report and summary * Update Risk Insights Report Data Type * Update encryption usage and test cases. Moved mock data * Remove unused variable * Move all-application constructor * Update all applications and risk insights to look at fetched logic * Fix name of variable. Fetch last report run * Cleanup all and critical application tabs drawer dependencies * Rename components from tool to dirt. Hook up all applications to use reportResult summary * Critical application cleanup. Trigger refetch of report for enriching when critical applications change * Fix type errors * Rename loader from tools to dirt. Cleanup * Add activity tab updates using data service * Use safeProviders in access intelligence * Fix refresh button not appearing. Change "refresh" to "run report" * Remove multiple async calls for isRunningReport * Fix report button not showing * Add no report ran message * Fix password change on critical applications
84 lines
3.3 KiB
TypeScript
84 lines
3.3 KiB
TypeScript
import { Component, DestroyRef, inject, OnInit } from "@angular/core";
|
|
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
|
import { ActivatedRoute } from "@angular/router";
|
|
import { firstValueFrom } from "rxjs";
|
|
|
|
import {
|
|
AllActivitiesService,
|
|
RiskInsightsDataService,
|
|
} from "@bitwarden/bit-common/dirt/reports/risk-insights";
|
|
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
|
|
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
|
|
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
|
import { getUserId } from "@bitwarden/common/auth/services/account.service";
|
|
import { getById } from "@bitwarden/common/platform/misc";
|
|
import { SharedModule } from "@bitwarden/web-vault/app/shared";
|
|
|
|
import { ActivityCardComponent } from "./activity-card.component";
|
|
import { PasswordChangeMetricComponent } from "./activity-cards/password-change-metric.component";
|
|
import { ApplicationsLoadingComponent } from "./risk-insights-loading.component";
|
|
import { RiskInsightsTabType } from "./risk-insights.component";
|
|
|
|
@Component({
|
|
selector: "dirt-all-activity",
|
|
imports: [
|
|
ApplicationsLoadingComponent,
|
|
SharedModule,
|
|
ActivityCardComponent,
|
|
PasswordChangeMetricComponent,
|
|
],
|
|
templateUrl: "./all-activity.component.html",
|
|
})
|
|
export class AllActivityComponent implements OnInit {
|
|
organization: Organization | null = null;
|
|
totalCriticalAppsAtRiskMemberCount = 0;
|
|
totalCriticalAppsCount = 0;
|
|
totalCriticalAppsAtRiskCount = 0;
|
|
passwordChangeMetricHasProgressBar = false;
|
|
|
|
destroyRef = inject(DestroyRef);
|
|
|
|
async ngOnInit(): Promise<void> {
|
|
const organizationId = this.activatedRoute.snapshot.paramMap.get("organizationId");
|
|
const userId = await firstValueFrom(getUserId(this.accountService.activeAccount$));
|
|
|
|
if (organizationId) {
|
|
this.organization =
|
|
(await firstValueFrom(
|
|
this.organizationService.organizations$(userId).pipe(getById(organizationId)),
|
|
)) ?? null;
|
|
|
|
this.allActivitiesService.reportSummary$
|
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
.subscribe((summary) => {
|
|
this.totalCriticalAppsAtRiskMemberCount = summary.totalCriticalAtRiskMemberCount;
|
|
this.totalCriticalAppsCount = summary.totalCriticalApplicationCount;
|
|
this.totalCriticalAppsAtRiskCount = summary.totalCriticalAtRiskApplicationCount;
|
|
});
|
|
|
|
this.allActivitiesService.passwordChangeProgressMetricHasProgressBar$
|
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
.subscribe((hasProgressBar) => {
|
|
this.passwordChangeMetricHasProgressBar = hasProgressBar;
|
|
});
|
|
}
|
|
}
|
|
|
|
constructor(
|
|
protected activatedRoute: ActivatedRoute,
|
|
private accountService: AccountService,
|
|
protected organizationService: OrganizationService,
|
|
protected dataService: RiskInsightsDataService,
|
|
protected allActivitiesService: AllActivitiesService,
|
|
) {}
|
|
|
|
get RiskInsightsTabType() {
|
|
return RiskInsightsTabType;
|
|
}
|
|
|
|
getLinkForRiskInsightsTab(tabIndex: RiskInsightsTabType): string {
|
|
const organizationId = this.activatedRoute.snapshot.paramMap.get("organizationId");
|
|
return `/organizations/${organizationId}/access-intelligence/risk-insights?tabIndex=${tabIndex}`;
|
|
}
|
|
}
|