From 5fedfdbf15e654d6428fcceb7f24981df40c3ee9 Mon Sep 17 00:00:00 2001 From: Shane Melton Date: Thu, 1 Sep 2022 10:08:59 -0700 Subject: [PATCH] [EC-18] Reporting side nav direction (#3420) * [EC-18] Re-order side nav for org reports according to Figma * [EC-18] Fix rxjs linter errors and redundant org flag --- .../reporting/reporting.component.html | 16 +++++------ .../reporting/reporting.component.ts | 28 +++++++++++++------ 2 files changed, 27 insertions(+), 17 deletions(-) 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 }}
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(); } }