[EC-282/EC-286] Update queryParams to use new filter object (#2985)

* [EC-282] Update queryParams to use new filter object

* Removed unused properties

* Removed unused method/property for organization vault

* Fixed organization trash filter
This commit is contained in:
Vincent Salucci 2022-06-29 15:12:08 -05:00 committed by GitHub
parent 3ae30d866c
commit a89b745f0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 18 deletions

View File

@ -57,16 +57,12 @@ export class IndividualVaultComponent implements OnInit, OnDestroy {
@ViewChild("updateKeyTemplate", { read: ViewContainerRef, static: true }) @ViewChild("updateKeyTemplate", { read: ViewContainerRef, static: true })
updateKeyModalRef: ViewContainerRef; updateKeyModalRef: ViewContainerRef;
favorites = false;
folderId: string = null; folderId: string = null;
collectionId: string = null;
organizationId: string = null;
myVaultOnly = false; myVaultOnly = false;
showVerifyEmail = false; showVerifyEmail = false;
showBrowserOutdated = false; showBrowserOutdated = false;
showUpdateKey = false; showUpdateKey = false;
showPremiumCallout = false; showPremiumCallout = false;
deleted = false;
trashCleanupWarning: string = null; trashCleanupWarning: string = null;
activeFilter: VaultFilter = new VaultFilter(); activeFilter: VaultFilter = new VaultFilter();
@ -402,11 +398,11 @@ export class IndividualVaultComponent implements OnInit, OnDestroy {
private go(queryParams: any = null) { private go(queryParams: any = null) {
if (queryParams == null) { if (queryParams == null) {
queryParams = { queryParams = {
favorites: this.favorites ? true : null, favorites: this.activeFilter.status === "favorites" ? true : null,
type: this.activeFilter.cipherType, type: this.activeFilter.cipherType,
folderId: this.folderId, folderId: this.activeFilter.selectedFolderId,
collectionId: this.collectionId, collectionId: this.activeFilter.selectedCollectionId,
deleted: this.deleted ? true : null, deleted: this.activeFilter.status === "trash" ? true : null,
}; };
} }

View File

@ -54,7 +54,6 @@ export class OrganizationVaultComponent implements OnInit, OnDestroy {
organization: Organization; organization: Organization;
collectionId: string = null; collectionId: string = null;
type: CipherType = null; type: CipherType = null;
deleted = false;
trashCleanupWarning: string = null; trashCleanupWarning: string = null;
activeFilter: VaultFilter = new VaultFilter(); activeFilter: VaultFilter = new VaultFilter();
@ -152,6 +151,10 @@ export class OrganizationVaultComponent implements OnInit, OnDestroy {
}); });
} }
get deleted(): boolean {
return this.activeFilter.status === "trash";
}
ngOnDestroy() { ngOnDestroy() {
this.broadcasterService.unsubscribe(BroadcasterSubscriptionId); this.broadcasterService.unsubscribe(BroadcasterSubscriptionId);
} }
@ -171,7 +174,7 @@ export class OrganizationVaultComponent implements OnInit, OnDestroy {
if (this.activeFilter.status === "favorites" && cipherPassesFilter) { if (this.activeFilter.status === "favorites" && cipherPassesFilter) {
cipherPassesFilter = cipher.favorite; cipherPassesFilter = cipher.favorite;
} }
if (this.activeFilter.status === "trash" && cipherPassesFilter) { if (this.deleted && cipherPassesFilter) {
cipherPassesFilter = cipher.isDeleted; cipherPassesFilter = cipher.isDeleted;
} }
if (this.activeFilter.cipherType != null && cipherPassesFilter) { if (this.activeFilter.cipherType != null && cipherPassesFilter) {
@ -331,17 +334,11 @@ export class OrganizationVaultComponent implements OnInit, OnDestroy {
}); });
} }
private clearFilters() {
this.collectionId = null;
this.type = null;
this.deleted = false;
}
private go(queryParams: any = null) { private go(queryParams: any = null) {
if (queryParams == null) { if (queryParams == null) {
queryParams = { queryParams = {
type: this.type, type: this.activeFilter.cipherType,
collectionId: this.collectionId, collectionId: this.activeFilter.selectedCollectionId,
deleted: this.deleted ? true : null, deleted: this.deleted ? true : null,
}; };
} }