mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-23 02:31:26 +01:00
[PM-17656] Update the org vault filter whenever policies update (#13280)
This commit is contained in:
parent
33e1a6e917
commit
1bcfcc7dec
@ -2,7 +2,7 @@
|
||||
// @ts-strict-ignore
|
||||
import { Component, EventEmitter, inject, Input, OnDestroy, OnInit, Output } from "@angular/core";
|
||||
import { Router } from "@angular/router";
|
||||
import { firstValueFrom, Subject } from "rxjs";
|
||||
import { firstValueFrom, merge, Subject, switchMap, takeUntil } from "rxjs";
|
||||
|
||||
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
|
||||
import { PolicyType } from "@bitwarden/common/admin-console/enums";
|
||||
@ -109,6 +109,19 @@ export class VaultFilterComponent implements OnInit, OnDestroy {
|
||||
this.activeFilter.selectedCipherTypeNode =
|
||||
(await this.getDefaultFilter()) as TreeNode<CipherTypeFilter>;
|
||||
this.isLoaded = true;
|
||||
|
||||
// Without refactoring the entire component, we need to manually update the organization filter whenever the policies update
|
||||
merge(
|
||||
this.policyService.get$(PolicyType.SingleOrg),
|
||||
this.policyService.get$(PolicyType.PersonalOwnership),
|
||||
)
|
||||
.pipe(
|
||||
switchMap(() => this.addOrganizationFilter()),
|
||||
takeUntil(this.destroy$),
|
||||
)
|
||||
.subscribe((orgFilters) => {
|
||||
this.filters.organizationFilter = orgFilters;
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
|
Loading…
Reference in New Issue
Block a user