1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-06 00:13:28 +00:00

[PM-27648] [Defect] The .zip option is displayed on organizational export in Admin Console (#17140)

* consider admin console context when determining export types and callout

* checkpoint on simplified fix before swapping to signals

* Update libs/tools/export/vault-export/vault-export-ui/src/components/export.component.ts

Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>

* Update libs/tools/export/vault-export/vault-export-ui/src/components/export.component.ts

Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>

---------

Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>
This commit is contained in:
John Harrington
2025-11-04 14:34:22 -07:00
committed by GitHub
parent c42a7b2ef5
commit 8e8092c828

View File

@@ -342,13 +342,25 @@ export class ExportComponent implements OnInit, OnDestroy, AfterViewInit {
}
private observeFormSelections(): void {
// Set up dynamic format options based on vault selection
this.formatOptions$ = this.exportForm.controls.vaultSelector.valueChanges.pipe(
startWith(this.exportForm.controls.vaultSelector.value),
map((vaultSelection) => {
const isMyVault = vaultSelection === "myVault";
// Update organizationId based on vault selection
this.organizationId = isMyVault ? undefined : vaultSelection;
// Update organizationId when vault selection changes
// In Admin Console context, organizationId is already set via @Input
// In Password Manager context, user changes vaultSelector which updates _organizationId$
this.exportForm.controls.vaultSelector.valueChanges
.pipe(takeUntil(this.destroy$))
.subscribe((vaultSelection) => {
if (!this.isAdminConsoleContext) {
// Password Manager: Update organizationId based on vaultSelector
const isMyVault = vaultSelection === "myVault";
this.organizationId = isMyVault ? undefined : vaultSelection;
}
// Admin Console: organizationId is already set via @Input, no update needed
});
// Set up dynamic format options based on the organizationId observable
// This is the single source of truth for both export contexts
this.formatOptions$ = this._organizationId$.pipe(
map((organizationId) => {
const isMyVault = !organizationId;
return { isMyVault };
}),
switchMap((options) => this.exportService.formats$(options)),