1
0
mirror of https://github.com/bitwarden/browser synced 2026-03-02 19:41:26 +00:00

PR followup:

- removed `DesktopRoutedVaultFilterBridgeService`
- added 'baseRoute' injectable in `RoutedVaultFilterService`
- removed `folderAddEditModalRef` from `VaultComponent`
This commit is contained in:
Leslie Xiong
2026-01-06 17:12:25 -05:00
parent 4ae43048cd
commit 26b2c5a03e
5 changed files with 22 additions and 60 deletions

View File

@@ -1,14 +1,20 @@
import { Injectable, OnDestroy } from "@angular/core";
import { Injectable, OnDestroy, inject } from "@angular/core";
import { ActivatedRoute, NavigationExtras } from "@angular/router";
import { combineLatest, map, Observable, Subject, takeUntil } from "rxjs";
import { CollectionId, OrganizationId } from "@bitwarden/common/types/guid";
import { SafeInjectionToken } from "@bitwarden/ui-common";
import {
isRoutedVaultFilterItemType,
RoutedVaultFilterModel,
} from "../models/routed-vault-filter.model";
/**
* Injection token for the base route path used in vault filter navigation.
*/
export const VAULT_FILTER_BASE_ROUTE = new SafeInjectionToken<string>("VaultFilterBaseRoute");
/**
* This service is an abstraction layer on top of ActivatedRoute that
* encapsulates the logic of how filters are stored in the URL.
@@ -19,6 +25,7 @@ import {
@Injectable()
export class RoutedVaultFilterService implements OnDestroy {
private onDestroy = new Subject<void>();
private baseRoute: string = inject(VAULT_FILTER_BASE_ROUTE, { optional: true }) ?? "";
/**
* Filter values extracted from the URL.
@@ -64,7 +71,7 @@ export class RoutedVaultFilterService implements OnDestroy {
* @returns route that can be used with Router or RouterLink
*/
createRoute(filter: RoutedVaultFilterModel): [commands: any[], extras?: NavigationExtras] {
const commands: string[] = [];
const commands: string[] = this.baseRoute ? [this.baseRoute] : [];
const extras: NavigationExtras = {
queryParams: {
collectionId: filter.collectionId ?? null,