mirror of
https://github.com/bitwarden/browser
synced 2025-12-23 11:43:46 +00:00
paging ciphers for better performance
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
<ng-container *ngIf="ciphers">
|
||||
<table class="table table-hover table-list table-ciphers" *ngIf="ciphers.length > 0">
|
||||
<ng-container *ngIf="(isPaging() ? pagedCiphers : ciphers) as filteredCiphers">
|
||||
<table class="table table-hover table-list table-ciphers" *ngIf="filteredCiphers.length" infiniteScroll
|
||||
[infiniteScrollDistance]="1" [infiniteScrollDisabled]="!isPaging()" (scrolled)="loadMore()">
|
||||
<tbody>
|
||||
<tr *ngFor="let c of ciphers">
|
||||
<tr *ngFor="let c of filteredCiphers">
|
||||
<td (click)="checkCipher(c)" class="table-list-checkbox" *ngIf="!organization">
|
||||
<input type="checkbox" [(ngModel)]="c.checked" appStopProp>
|
||||
</td>
|
||||
@@ -62,7 +63,7 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="no-items" *ngIf="ciphers.length === 0">
|
||||
<div class="no-items" *ngIf="!filteredCiphers.length">
|
||||
<i class="fa fa-spinner fa-spin text-muted" *ngIf="!loaded" title="{{'loading' | i18n}}"></i>
|
||||
<ng-container *ngIf="loaded">
|
||||
<p>{{'noItemsInList' | i18n}}</p>
|
||||
|
||||
@@ -39,6 +39,7 @@ export class CiphersComponent extends BaseCiphersComponent implements OnDestroy
|
||||
protected toasterService: ToasterService, protected i18nService: I18nService,
|
||||
protected platformUtilsService: PlatformUtilsService, protected cipherService: CipherService) {
|
||||
super(searchService);
|
||||
this.pageSize = 150;
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
|
||||
@@ -102,7 +102,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||
|
||||
if (params == null) {
|
||||
this.groupingsComponent.selectedAll = true;
|
||||
await this.ciphersComponent.load();
|
||||
await this.ciphersComponent.reload();
|
||||
} else {
|
||||
if (params.favorites) {
|
||||
this.groupingsComponent.selectedFavorites = true;
|
||||
@@ -120,7 +120,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||
await this.filterCollection(params.collectionId);
|
||||
} else {
|
||||
this.groupingsComponent.selectedAll = true;
|
||||
await this.ciphersComponent.load();
|
||||
await this.ciphersComponent.reload();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||
async clearGroupingFilters() {
|
||||
this.ciphersComponent.showAddNew = true;
|
||||
this.groupingsComponent.searchPlaceholder = this.i18nService.t('searchVault');
|
||||
await this.ciphersComponent.load();
|
||||
await this.ciphersComponent.reload();
|
||||
this.clearFilters();
|
||||
this.go();
|
||||
}
|
||||
@@ -162,7 +162,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||
async filterFavorites() {
|
||||
this.ciphersComponent.showAddNew = true;
|
||||
this.groupingsComponent.searchPlaceholder = this.i18nService.t('searchFavorites');
|
||||
await this.ciphersComponent.load((c) => c.favorite);
|
||||
await this.ciphersComponent.reload((c) => c.favorite);
|
||||
this.clearFilters();
|
||||
this.favorites = true;
|
||||
this.go();
|
||||
@@ -171,7 +171,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||
async filterCipherType(type: CipherType) {
|
||||
this.ciphersComponent.showAddNew = true;
|
||||
this.groupingsComponent.searchPlaceholder = this.i18nService.t('searchType');
|
||||
await this.ciphersComponent.load((c) => c.type === type);
|
||||
await this.ciphersComponent.reload((c) => c.type === type);
|
||||
this.clearFilters();
|
||||
this.type = type;
|
||||
this.go();
|
||||
@@ -181,7 +181,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||
this.ciphersComponent.showAddNew = true;
|
||||
folderId = folderId === 'none' ? null : folderId;
|
||||
this.groupingsComponent.searchPlaceholder = this.i18nService.t('searchFolder');
|
||||
await this.ciphersComponent.load((c) => c.folderId === folderId);
|
||||
await this.ciphersComponent.reload((c) => c.folderId === folderId);
|
||||
this.clearFilters();
|
||||
this.folderId = folderId == null ? 'none' : folderId;
|
||||
this.go();
|
||||
@@ -190,7 +190,8 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||
async filterCollection(collectionId: string) {
|
||||
this.ciphersComponent.showAddNew = true;
|
||||
this.groupingsComponent.searchPlaceholder = this.i18nService.t('searchCollection');
|
||||
await this.ciphersComponent.load((c) => c.collectionIds != null && c.collectionIds.indexOf(collectionId) > -1);
|
||||
await this.ciphersComponent.reload((c) => c.collectionIds != null &&
|
||||
c.collectionIds.indexOf(collectionId) > -1);
|
||||
this.clearFilters();
|
||||
this.collectionId = collectionId;
|
||||
this.go();
|
||||
|
||||
Reference in New Issue
Block a user