[PM-10757] Pass current tab uri in new item dropdown (#10505)
This commit is contained in:
parent
a1d94233e3
commit
8274ea783c
|
@ -14,6 +14,7 @@ export interface NewItemInitialValues {
|
|||
folderId?: string;
|
||||
organizationId?: OrganizationId;
|
||||
collectionId?: CollectionId;
|
||||
uri?: string;
|
||||
}
|
||||
|
||||
@Component({
|
||||
|
@ -42,6 +43,7 @@ export class NewItemDropdownV2Component {
|
|||
collectionId: this.initialValues?.collectionId,
|
||||
organizationId: this.initialValues?.organizationId,
|
||||
folderId: this.initialValues?.folderId,
|
||||
uri: this.initialValues?.uri,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import { CommonModule } from "@angular/common";
|
|||
import { Component, OnDestroy, OnInit } from "@angular/core";
|
||||
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
||||
import { RouterLink } from "@angular/router";
|
||||
import { combineLatest, map, Observable, shareReplay } from "rxjs";
|
||||
import { combineLatest, Observable, shareReplay, switchMap } from "rxjs";
|
||||
|
||||
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
||||
import { CollectionId, OrganizationId } from "@bitwarden/common/types/guid";
|
||||
|
@ -11,6 +11,7 @@ import { ButtonModule, Icons, NoItemsModule } from "@bitwarden/components";
|
|||
import { VaultIcons } from "@bitwarden/vault";
|
||||
|
||||
import { CurrentAccountComponent } from "../../../../auth/popup/account-switching/current-account.component";
|
||||
import { BrowserApi } from "../../../../platform/browser/browser-api";
|
||||
import { PopOutComponent } from "../../../../platform/popup/components/pop-out.component";
|
||||
import { PopupHeaderComponent } from "../../../../platform/popup/layout/popup-header.component";
|
||||
import { PopupPageComponent } from "../../../../platform/popup/layout/popup-page.component";
|
||||
|
@ -62,12 +63,16 @@ export class VaultV2Component implements OnInit, OnDestroy {
|
|||
|
||||
protected newItemItemValues$: Observable<NewItemInitialValues> =
|
||||
this.vaultPopupListFiltersService.filters$.pipe(
|
||||
map((filter) => ({
|
||||
organizationId: (filter.organization?.id ||
|
||||
filter.collection?.organizationId) as OrganizationId,
|
||||
collectionId: filter.collection?.id as CollectionId,
|
||||
folderId: filter.folder?.id,
|
||||
})),
|
||||
switchMap(
|
||||
async (filter) =>
|
||||
({
|
||||
organizationId: (filter.organization?.id ||
|
||||
filter.collection?.organizationId) as OrganizationId,
|
||||
collectionId: filter.collection?.id as CollectionId,
|
||||
folderId: filter.folder?.id,
|
||||
uri: (await BrowserApi.getTabFromCurrentWindow())?.url,
|
||||
}) as NewItemInitialValues,
|
||||
),
|
||||
shareReplay({ refCount: true, bufferSize: 1 }),
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue