diff --git a/apps/web/src/app/organizations/reporting/reporting.component.html b/apps/web/src/app/organizations/reporting/reporting.component.html index 975d34e76fa..f7a3ae11a11 100644 --- a/apps/web/src/app/organizations/reporting/reporting.component.html +++ b/apps/web/src/app/organizations/reporting/reporting.component.html @@ -4,6 +4,14 @@
{{ "reporting" | i18n }}
+ + {{ "eventLogs" | i18n }} + {{ "reports" | i18n }} - - {{ "eventLogs" | i18n }} -
diff --git a/apps/web/src/app/organizations/reporting/reporting.component.ts b/apps/web/src/app/organizations/reporting/reporting.component.ts index fe0015499f3..880de67c0fd 100644 --- a/apps/web/src/app/organizations/reporting/reporting.component.ts +++ b/apps/web/src/app/organizations/reporting/reporting.component.ts @@ -1,5 +1,6 @@ -import { Component, OnInit } from "@angular/core"; +import { Component, OnDestroy, OnInit } from "@angular/core"; import { ActivatedRoute } from "@angular/router"; +import { concatMap, Subject, takeUntil } from "rxjs"; import { OrganizationService } from "@bitwarden/common/abstractions/organization.service"; import { Organization } from "@bitwarden/common/models/domain/organization"; @@ -8,19 +9,28 @@ import { Organization } from "@bitwarden/common/models/domain/organization"; selector: "app-org-reporting", templateUrl: "reporting.component.html", }) -// eslint-disable-next-line rxjs-angular/prefer-takeuntil -export class ReportingComponent implements OnInit { +export class ReportingComponent implements OnInit, OnDestroy { organization: Organization; - accessEvents = false; showLeftNav = true; + private destroy$ = new Subject(); + constructor(private route: ActivatedRoute, private organizationService: OrganizationService) {} ngOnInit() { - // eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe - this.route.parent.params.subscribe(async (params) => { - this.organization = await this.organizationService.get(params.organizationId); - this.accessEvents = this.showLeftNav = this.organization.useEvents; - }); + this.route.params + .pipe( + concatMap(async (params) => { + this.organization = await this.organizationService.get(params.organizationId); + this.showLeftNav = this.organization.canAccessEventLogs; + }), + takeUntil(this.destroy$) + ) + .subscribe(); + } + + ngOnDestroy(): void { + this.destroy$.next(); + this.destroy$.complete(); } }