From 58611fdd00b55e6dfdeecba0ffc78aee77d4c1ab Mon Sep 17 00:00:00 2001 From: Robyn MacCallum Date: Tue, 17 May 2022 17:03:57 -0400 Subject: [PATCH] [SG-300] Adding an Item defaults owner to selected vault (#2697) --- apps/browser/src/popup/vault/add-edit.component.ts | 3 +++ apps/browser/src/popup/vault/ciphers.component.ts | 1 + apps/browser/src/popup/vault/current-tab.component.ts | 8 +++++++- apps/browser/src/popup/vault/vault-filter.component.html | 2 +- apps/browser/src/popup/vault/vault-filter.component.ts | 4 +++- apps/browser/src/popup/vault/vault-select.component.ts | 1 + 6 files changed, 16 insertions(+), 3 deletions(-) diff --git a/apps/browser/src/popup/vault/add-edit.component.ts b/apps/browser/src/popup/vault/add-edit.component.ts index c8524da5a2..d286b96875 100644 --- a/apps/browser/src/popup/vault/add-edit.component.ts +++ b/apps/browser/src/popup/vault/add-edit.component.ts @@ -95,6 +95,9 @@ export class AddEditComponent extends BaseAddEditComponent { if (params.cloneMode != null) { this.cloneMode = params.cloneMode === "true"; } + if (params.selectedVault) { + this.organizationId = params.selectedVault; + } await this.load(); if (!this.editMode || this.cloneMode) { diff --git a/apps/browser/src/popup/vault/ciphers.component.ts b/apps/browser/src/popup/vault/ciphers.component.ts index 59d8babd25..fd58a8e713 100644 --- a/apps/browser/src/popup/vault/ciphers.component.ts +++ b/apps/browser/src/popup/vault/ciphers.component.ts @@ -234,6 +234,7 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On folderId: this.folderId, type: this.type, collectionId: this.collectionId, + selectedVault: this.vaultFilter.selectedOrganizationId, }, }); } diff --git a/apps/browser/src/popup/vault/current-tab.component.ts b/apps/browser/src/popup/vault/current-tab.component.ts index 999e6c36b6..726a291689 100644 --- a/apps/browser/src/popup/vault/current-tab.component.ts +++ b/apps/browser/src/popup/vault/current-tab.component.ts @@ -118,7 +118,13 @@ export class CurrentTabComponent implements OnInit, OnDestroy { } addCipher() { - this.router.navigate(["/add-cipher"], { queryParams: { name: this.hostname, uri: this.url } }); + this.router.navigate(["/add-cipher"], { + queryParams: { + name: this.hostname, + uri: this.url, + selectedVault: this.vaultFilterService.getVaultFilter().selectedOrganizationId, + }, + }); } viewCipher(cipher: CipherView) { diff --git a/apps/browser/src/popup/vault/vault-filter.component.html b/apps/browser/src/popup/vault/vault-filter.component.html index 44d4ce6583..4c2ce65f42 100644 --- a/apps/browser/src/popup/vault/vault-filter.component.html +++ b/apps/browser/src/popup/vault/vault-filter.component.html @@ -22,7 +22,7 @@ -
+
diff --git a/apps/browser/src/popup/vault/vault-filter.component.ts b/apps/browser/src/popup/vault/vault-filter.component.ts index ec743e5289..9c663d8a91 100644 --- a/apps/browser/src/popup/vault/vault-filter.component.ts +++ b/apps/browser/src/popup/vault/vault-filter.component.ts @@ -266,7 +266,9 @@ export class VaultFilterComponent implements OnInit, OnDestroy { } async addCipher() { - this.router.navigate(["/add-cipher"]); + this.router.navigate(["/add-cipher"], { + queryParams: { selectedVault: this.vaultFilter.selectedOrganizationId }, + }); } async vaultFilterChanged() { diff --git a/apps/browser/src/popup/vault/vault-select.component.ts b/apps/browser/src/popup/vault/vault-select.component.ts index 1067c0ff51..fb5178cfd4 100644 --- a/apps/browser/src/popup/vault/vault-select.component.ts +++ b/apps/browser/src/popup/vault/vault-select.component.ts @@ -145,6 +145,7 @@ export class VaultSelectComponent implements OnInit { positionStrategy, maxHeight: viewPortHeight - 160, backdropClass: "cdk-overlay-transparent-backdrop", + scrollStrategy: this.overlay.scrollStrategies.close(), }); const templatePortal = new TemplatePortal(this.templateRef, this.viewContainerRef);