mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 09:13:33 +00:00
SM-1146: Display total counts of projects, machine accounts, secrets in Secrets Manager (#9791)
* SM-1146: Secrets Manager total counts * SM-1146: Tab link component simplifications * SM-1146: Total counts update on CRUD * SM-1146: Total counts API paths update * SM-1146: Unit test coverage for services * SM-1146: Fix incorrect types returned * SM-1146: Storybook example for tab-link with child counter * SM-1146: Tailwind states with groups * SM-1146: Moving counts view types in one file * SM-1146: Moving counts methods, responses to one shared service * SM-1146: Removing redundant services imports * SM-1146: Removing redundant observables * SM-1337: Total counts hidden for suspended organizations * SM-1336: Total counts updated on import * SM-1336: Import error handling refactor * SM-1336: Import error handling improvements * SM-1336: Import error not working with project errors, Unit Test coverage * Update bitwarden_license/bit-web/src/app/secrets-manager/settings/porting/sm-import.component.ts Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com> * SM-1336: UT deprecation removal * SM-1336: Better UT * SM-1336: Lint fix * SM-1146: Linter fix --------- Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Component, OnDestroy, OnInit } from "@angular/core";
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import {
|
||||
combineLatest,
|
||||
filter,
|
||||
@@ -13,11 +13,13 @@ import {
|
||||
} from "rxjs";
|
||||
|
||||
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { DialogService } from "@bitwarden/components";
|
||||
|
||||
import { ProjectCounts } from "../../models/view/counts.view";
|
||||
import { ProjectView } from "../../models/view/project.view";
|
||||
import { SecretService } from "../../secrets/secret.service";
|
||||
import { AccessPolicyService } from "../../shared/access-policies/access-policy.service";
|
||||
import { CountService } from "../../shared/counts/count.service";
|
||||
import {
|
||||
OperationType,
|
||||
ProjectDialogComponent,
|
||||
@@ -31,6 +33,7 @@ import { ProjectService } from "../project.service";
|
||||
})
|
||||
export class ProjectComponent implements OnInit, OnDestroy {
|
||||
protected project$: Observable<ProjectView>;
|
||||
protected projectCounts: ProjectCounts;
|
||||
|
||||
private organizationId: string;
|
||||
private projectId: string;
|
||||
@@ -40,11 +43,11 @@ export class ProjectComponent implements OnInit, OnDestroy {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private projectService: ProjectService,
|
||||
private router: Router,
|
||||
private secretService: SecretService,
|
||||
private accessPolicyService: AccessPolicyService,
|
||||
private dialogService: DialogService,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private i18nService: I18nService,
|
||||
private organizationService: OrganizationService,
|
||||
private countService: CountService,
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
@@ -62,13 +65,23 @@ export class ProjectComponent implements OnInit, OnDestroy {
|
||||
const organization$ = this.route.params.pipe(
|
||||
concatMap((params) => this.organizationService.get$(params.organizationId)),
|
||||
);
|
||||
const projectCounts$ = combineLatest([
|
||||
this.route.params,
|
||||
this.secretService.secret$.pipe(startWith(null)),
|
||||
this.accessPolicyService.accessPolicy$.pipe(startWith(null)),
|
||||
]).pipe(switchMap(([params]) => this.countService.getProjectCounts(params.projectId)));
|
||||
|
||||
combineLatest([projectId$, organization$])
|
||||
combineLatest([projectId$, organization$, projectCounts$])
|
||||
.pipe(takeUntil(this.destroy$))
|
||||
.subscribe(([projectId, organization]) => {
|
||||
.subscribe(([projectId, organization, projectCounts]) => {
|
||||
this.organizationId = organization.id;
|
||||
this.projectId = projectId;
|
||||
this.organizationEnabled = organization.enabled;
|
||||
this.projectCounts = {
|
||||
secrets: projectCounts.secrets,
|
||||
people: projectCounts.people,
|
||||
serviceAccounts: projectCounts.serviceAccounts,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user