[fix] Prefill add cipher form from filter data (#2700)

This commit is contained in:
Addison Beck 2022-05-18 10:36:33 -04:00 committed by GitHub
parent 83ccbf2c90
commit ee43ef9ba1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 10 deletions

View File

@ -397,7 +397,7 @@ export class VaultComponent implements OnInit, OnDestroy {
this.addType = type;
this.action = "add";
this.cipherId = null;
this.updateCollectionProperties();
this.prefillNewCipherFromFilter();
this.go();
}
@ -747,19 +747,21 @@ export class VaultComponent implements OnInit, OnDestroy {
});
}
private updateCollectionProperties() {
if (this.collectionId != null) {
const collection = this.vaultFilterComponent.collections?.fullList?.filter(
(c) => c.id === this.collectionId
private prefillNewCipherFromFilter() {
if (this.activeFilter.selectedCollectionId != null) {
const collection = this.vaultFilterComponent.collections.fullList.filter(
(c) => c.id === this.activeFilter.selectedCollectionId
);
if (collection != null && collection.length > 0) {
if (collection.length > 0) {
this.addOrganizationId = collection[0].organizationId;
this.addCollectionIds = [this.collectionId];
return;
this.addCollectionIds = [this.activeFilter.selectedCollectionId];
}
} else if (this.activeFilter.selectedOrganizationId) {
this.addOrganizationId = this.activeFilter.selectedOrganizationId;
}
if (this.activeFilter.selectedFolderId && this.activeFilter.selectedFolder) {
this.folderId = this.activeFilter.selectedFolderId;
}
this.addOrganizationId = null;
this.addCollectionIds = null;
}
private async canNavigateAway(action: string, cipher?: CipherView) {