mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
set org and collections on add based on filters
This commit is contained in:
2
jslib
2
jslib
Submodule jslib updated: aa0b274f8f...a98a8bda9b
@@ -27,7 +27,12 @@ export class AddEditComponent extends BaseAddEditComponent implements OnChanges
|
|||||||
userService, collectionService);
|
userService, collectionService);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async ngOnInit() {
|
||||||
|
// We use ngOnChanges instead.
|
||||||
|
}
|
||||||
|
|
||||||
async ngOnChanges() {
|
async ngOnChanges() {
|
||||||
|
await super.init();
|
||||||
await super.load();
|
await super.load();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
<app-vault-add-edit id="details"
|
<app-vault-add-edit id="details"
|
||||||
*ngIf="action === 'add' || action === 'edit'"
|
*ngIf="action === 'add' || action === 'edit'"
|
||||||
[folderId]="action === 'add' && folderId !== 'none' ? folderId : null"
|
[folderId]="action === 'add' && folderId !== 'none' ? folderId : null"
|
||||||
|
[organizationId]="action === 'add' ? addOrganizationId : null"
|
||||||
|
[collectionIds]="action === 'add' ? addCollectionIds : null"
|
||||||
[type]="action === 'add' ? (addType ? addType : type) : null"
|
[type]="action === 'add' ? (addType ? addType : type) : null"
|
||||||
[cipherId]="action === 'edit' ? cipherId : null"
|
[cipherId]="action === 'edit' ? cipherId : null"
|
||||||
(onSavedCipher)="savedCipher($event)"
|
(onSavedCipher)="savedCipher($event)"
|
||||||
|
|||||||
@@ -70,6 +70,8 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
folderId: string = null;
|
folderId: string = null;
|
||||||
collectionId: string = null;
|
collectionId: string = null;
|
||||||
addType: CipherType = null;
|
addType: CipherType = null;
|
||||||
|
addOrganizationId: string = null;
|
||||||
|
addCollectionIds: string[] = null;
|
||||||
|
|
||||||
private modal: ModalComponent = null;
|
private modal: ModalComponent = null;
|
||||||
|
|
||||||
@@ -296,6 +298,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
this.addType = type;
|
this.addType = type;
|
||||||
this.action = 'add';
|
this.action = 'add';
|
||||||
this.cipherId = null;
|
this.cipherId = null;
|
||||||
|
this.updateCollectionProperties();
|
||||||
this.go();
|
this.go();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -455,6 +458,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
await this.ciphersComponent.load((c) => c.collectionIds != null && c.collectionIds.indexOf(collectionId) > -1);
|
await this.ciphersComponent.load((c) => c.collectionIds != null && c.collectionIds.indexOf(collectionId) > -1);
|
||||||
this.clearFilters();
|
this.clearFilters();
|
||||||
this.collectionId = collectionId;
|
this.collectionId = collectionId;
|
||||||
|
this.updateCollectionProperties();
|
||||||
this.go();
|
this.go();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -551,6 +555,9 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
this.collectionId = null;
|
this.collectionId = null;
|
||||||
this.favorites = false;
|
this.favorites = false;
|
||||||
this.type = null;
|
this.type = null;
|
||||||
|
this.addCollectionIds = null;
|
||||||
|
this.addType = null;
|
||||||
|
this.addOrganizationId = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private go(queryParams: any = null) {
|
private go(queryParams: any = null) {
|
||||||
@@ -587,4 +594,17 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
this.changeDetectorRef.detectChanges();
|
this.changeDetectorRef.detectChanges();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private updateCollectionProperties() {
|
||||||
|
if (this.collectionId != null) {
|
||||||
|
const collection = this.groupingsComponent.collections.filter((c) => c.id === this.collectionId);
|
||||||
|
if (collection.length > 0) {
|
||||||
|
this.addOrganizationId = collection[0].organizationId;
|
||||||
|
this.addCollectionIds = [this.collectionId];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.addOrganizationId = null;
|
||||||
|
this.addCollectionIds = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user