add selected vault filter to all new item dropdowns

This commit is contained in:
nick-livefront 2024-06-12 14:45:28 -05:00
parent 0692029606
commit e9efe9bd5a
No known key found for this signature in database
GPG Key ID: FF670021ABCAB82E
2 changed files with 17 additions and 6 deletions

View File

@ -1,7 +1,7 @@
<popup-page>
<popup-header slot="header" [pageTitle]="'vault' | i18n">
<ng-container slot="end">
<app-new-item-dropdown [selectedVaultId]="selectedVaultId$ | async"></app-new-item-dropdown>
<app-new-item-dropdown [selectedVaultId]="selectedVaultId"></app-new-item-dropdown>
<app-pop-out></app-pop-out>
<app-current-account></app-current-account>
@ -15,7 +15,10 @@
<bit-no-items [icon]="vaultIcon">
<ng-container slot="title">{{ "yourVaultIsEmpty" | i18n }}</ng-container>
<ng-container slot="description">{{ "autofillSuggestionsTip" | i18n }}</ng-container>
<app-new-item-dropdown slot="button"></app-new-item-dropdown>
<app-new-item-dropdown
slot="button"
[selectedVaultId]="selectedVaultId"
></app-new-item-dropdown>
</bit-no-items>
</div>

View File

@ -55,10 +55,8 @@ export class VaultV2Component {
protected favoriteCiphers$ = this.vaultPopupItemsService.favoriteCiphers$;
protected remainingCiphers$ = this.vaultPopupItemsService.remainingCiphers$;
protected selectedVaultId$ = this.vaultPopupListFiltersService.filters$.pipe(
filter((filters) => filters.organization?.id !== MY_VAULT_ID),
map((filters) => filters.organization?.id),
);
/** The `id` of the filtered organization */
protected selectedVaultId: string | null = null;
/** Visual state of the vault */
protected vaultState: VaultState | null = null;
@ -95,5 +93,15 @@ export class VaultV2Component {
this.vaultState = null;
}
});
this.vaultPopupListFiltersService.filters$
.pipe(
takeUntilDestroyed(),
filter((filters) => filters.organization?.id !== MY_VAULT_ID),
map((filters) => filters.organization?.id ?? null),
)
.subscribe((organizationId) => {
this.selectedVaultId = organizationId;
});
}
}