1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 15:53:27 +00:00

[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
This commit is contained in:
Shane Melton
2022-09-01 10:08:59 -07:00
committed by GitHub
parent 3df98f72c0
commit 5fedfdbf15
2 changed files with 27 additions and 17 deletions

View File

@@ -4,6 +4,14 @@
<div class="card" *ngIf="organization">
<div class="card-header">{{ "reporting" | i18n }}</div>
<div class="list-group list-group-flush">
<a
routerLink="events"
class="list-group-item"
routerLinkActive="active"
*ngIf="organization.canAccessEventLogs"
>
{{ "eventLogs" | i18n }}
</a>
<a
routerLink="reports"
class="list-group-item"
@@ -12,14 +20,6 @@
>
{{ "reports" | i18n }}
</a>
<a
routerLink="events"
class="list-group-item"
routerLinkActive="active"
*ngIf="organization.canAccessEventLogs && accessEvents"
>
{{ "eventLogs" | i18n }}
</a>
</div>
</div>
</div>

View File

@@ -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<void>();
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();
}
}