1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 07:43:35 +00:00

[AC-779] [Defect] Event log links for policies groups users and items not working (#5212)

* [AC-779] fix: policy link

* [AC-779] fix: search string set by url not showing in input field

* [AC-779] fix: navigation to cipher events

* [AC-779] fix: collection link

* [AC-779] chore: clean up old components

* [AC-779] chore: remove some copy pasta
This commit is contained in:
Andreas Coroiu
2023-04-18 08:04:39 +02:00
committed by GitHub
parent d77f77cea9
commit 4852992662
13 changed files with 67 additions and 512 deletions

View File

@@ -8,7 +8,14 @@ import {
ViewContainerRef,
} from "@angular/core";
import { ActivatedRoute, Params, Router } from "@angular/router";
import { BehaviorSubject, combineLatest, firstValueFrom, lastValueFrom, Subject } from "rxjs";
import {
BehaviorSubject,
combineLatest,
firstValueFrom,
lastValueFrom,
Observable,
Subject,
} from "rxjs";
import {
concatMap,
debounceTime,
@@ -123,9 +130,10 @@ export class VaultComponent implements OnInit, OnDestroy {
protected selectedCollection: TreeNode<CollectionAdminView> | undefined;
protected isEmpty: boolean;
protected showMissingCollectionPermissionMessage: boolean;
protected currentSearchText$: Observable<string>;
private refresh$ = new BehaviorSubject<void>(null);
private searchText$ = new Subject<string>();
private refresh$ = new BehaviorSubject<void>(null);
private destroy$ = new Subject<void>();
constructor(
@@ -219,7 +227,7 @@ export class VaultComponent implements OnInit, OnDestroy {
})
);
const querySearchText$ = this.route.queryParams.pipe(map((queryParams) => queryParams.search));
this.currentSearchText$ = this.route.queryParams.pipe(map((queryParams) => queryParams.search));
const allCollectionsWithoutUnassigned$ = organizationId$.pipe(
switchMap((orgId) => this.collectionAdminService.getAll(orgId)),
@@ -256,7 +264,7 @@ export class VaultComponent implements OnInit, OnDestroy {
})
);
const ciphers$ = combineLatest([allCiphers$, filter$, querySearchText$]).pipe(
const ciphers$ = combineLatest([allCiphers$, filter$, this.currentSearchText$]).pipe(
filter(([ciphers, filter]) => ciphers != undefined && filter != undefined),
concatMap(async ([ciphers, filter, searchText]) => {
if (filter.collectionId === undefined && filter.type === undefined) {
@@ -279,7 +287,7 @@ export class VaultComponent implements OnInit, OnDestroy {
shareReplay({ refCount: true, bufferSize: 1 })
);
const collections$ = combineLatest([nestedCollections$, filter$, querySearchText$]).pipe(
const collections$ = combineLatest([nestedCollections$, filter$, this.currentSearchText$]).pipe(
filter(([collections, filter]) => collections != undefined && filter != undefined),
map(([collections, filter, searchText]) => {
if (
@@ -379,6 +387,33 @@ export class VaultComponent implements OnInit, OnDestroy {
)
.subscribe();
firstSetup$
.pipe(
switchMap(() => combineLatest([this.route.queryParams, organization$, allCiphers$])),
switchMap(async ([qParams, organization, allCiphers$]) => {
const cipherId = qParams.viewEvents;
if (!cipherId) {
return;
}
const cipher = allCiphers$.find((c) => c.id === cipherId);
if (organization.useEvents && cipher != undefined) {
this.viewEvents(cipher);
} else {
this.platformUtilsService.showToast(
"error",
this.i18nService.t("errorOccurred"),
this.i18nService.t("unknownCipher")
);
this.router.navigate([], {
queryParams: { viewEvents: null },
queryParamsHandling: "merge",
});
}
}),
takeUntil(this.destroy$)
)
.subscribe();
firstSetup$
.pipe(
switchMap(() => this.refresh$),