mirror of
https://github.com/bitwarden/browser
synced 2025-12-21 02:33:46 +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:
@@ -21,6 +21,7 @@ import { LogService } from "@bitwarden/common/platform/abstractions/log.service"
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { DialogService } from "@bitwarden/components";
|
||||
|
||||
import { OrganizationCounts } from "../models/view/counts.view";
|
||||
import { ProjectListView } from "../models/view/project-list.view";
|
||||
import { SecretListView } from "../models/view/secret-list.view";
|
||||
import {
|
||||
@@ -51,6 +52,7 @@ import {
|
||||
ServiceAccountOperation,
|
||||
} from "../service-accounts/dialog/service-account-dialog.component";
|
||||
import { ServiceAccountService } from "../service-accounts/service-account.service";
|
||||
import { CountService } from "../shared/counts/count.service";
|
||||
import { SecretsListComponent } from "../shared/secrets-list.component";
|
||||
|
||||
import { SMOnboardingTasks, SMOnboardingTasksService } from "./sm-onboarding-tasks.service";
|
||||
@@ -87,11 +89,13 @@ export class OverviewComponent implements OnInit, OnDestroy {
|
||||
latestProjects: ProjectListView[];
|
||||
latestSecrets: SecretListView[];
|
||||
tasks: OrganizationTasks;
|
||||
counts: OrganizationCounts;
|
||||
}>;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private projectService: ProjectService,
|
||||
private countService: CountService,
|
||||
private secretService: SecretService,
|
||||
private serviceAccountService: ServiceAccountService,
|
||||
private dialogService: DialogService,
|
||||
@@ -148,10 +152,19 @@ export class OverviewComponent implements OnInit, OnDestroy {
|
||||
share(),
|
||||
);
|
||||
|
||||
const counts$ = combineLatest([
|
||||
orgId$,
|
||||
this.secretService.secret$.pipe(startWith(null)),
|
||||
this.projectService.project$.pipe(startWith(null)),
|
||||
]).pipe(
|
||||
switchMap(([orgId]) => this.countService.getOrganizationCounts(orgId)),
|
||||
share(),
|
||||
);
|
||||
|
||||
this.view$ = orgId$.pipe(
|
||||
switchMap((orgId) =>
|
||||
combineLatest([projects$, secrets$, serviceAccounts$]).pipe(
|
||||
switchMap(async ([projects, secrets, serviceAccounts]) => ({
|
||||
combineLatest([projects$, secrets$, serviceAccounts$, counts$]).pipe(
|
||||
switchMap(async ([projects, secrets, serviceAccounts, counts]) => ({
|
||||
latestProjects: this.getRecentItems(projects, this.tableSize),
|
||||
latestSecrets: this.getRecentItems(secrets, this.tableSize),
|
||||
allProjects: projects,
|
||||
@@ -162,6 +175,11 @@ export class OverviewComponent implements OnInit, OnDestroy {
|
||||
createProject: projects.length > 0,
|
||||
createServiceAccount: serviceAccounts.length > 0,
|
||||
}),
|
||||
counts: {
|
||||
projects: counts.projects,
|
||||
secrets: counts.secrets,
|
||||
serviceAccounts: counts.serviceAccounts,
|
||||
},
|
||||
})),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user