mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-18 11:05:41 +01:00
smaller list sizes on edge
This commit is contained in:
parent
cfa0e1044f
commit
15792a1ae6
@ -19,6 +19,7 @@ import { CipherService } from 'jslib/abstractions/cipher.service';
|
||||
import { CollectionService } from 'jslib/abstractions/collection.service';
|
||||
import { FolderService } from 'jslib/abstractions/folder.service';
|
||||
import { I18nService } from 'jslib/abstractions/i18n.service';
|
||||
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
||||
import { StateService } from 'jslib/abstractions/state.service';
|
||||
|
||||
import { CipherType } from 'jslib/enums/cipherType';
|
||||
@ -32,7 +33,6 @@ import { CiphersComponent as BaseCiphersComponent } from 'jslib/angular/componen
|
||||
import { PopupUtilsService } from '../services/popup-utils.service';
|
||||
|
||||
const ComponentId = 'CiphersComponent';
|
||||
const PageSize = 100;
|
||||
|
||||
@Component({
|
||||
selector: 'app-vault-ciphers',
|
||||
@ -50,6 +50,7 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
|
||||
private didScroll = false;
|
||||
private selectedTimeout: number;
|
||||
private preventSelected = false;
|
||||
private pageSize = 100;
|
||||
|
||||
constructor(cipherService: CipherService, private route: ActivatedRoute,
|
||||
private router: Router, private location: Location,
|
||||
@ -57,8 +58,9 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
|
||||
private changeDetectorRef: ChangeDetectorRef, private stateService: StateService,
|
||||
private popupUtils: PopupUtilsService, private i18nService: I18nService,
|
||||
private folderService: FolderService, private collectionService: CollectionService,
|
||||
private analytics: Angulartics2) {
|
||||
private analytics: Angulartics2, private platformUtilsService: PlatformUtilsService) {
|
||||
super(cipherService);
|
||||
this.pageSize = platformUtilsService.isEdge() ? 50 : 100;
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
@ -174,15 +176,15 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
|
||||
}
|
||||
|
||||
loadMore() {
|
||||
if (this.ciphers.length <= PageSize) {
|
||||
if (this.ciphers.length <= this.pageSize) {
|
||||
return;
|
||||
}
|
||||
|
||||
const pagedLength = this.pagedCiphers.length;
|
||||
if (this.ciphers.length > pagedLength) {
|
||||
this.pagedCiphers = this.pagedCiphers.concat(this.ciphers.slice(pagedLength, pagedLength + PageSize));
|
||||
this.pagedCiphers = this.pagedCiphers.concat(this.ciphers.slice(pagedLength, pagedLength + this.pageSize));
|
||||
}
|
||||
this.didScroll = this.pagedCiphers.length > PageSize;
|
||||
this.didScroll = this.pagedCiphers.length > this.pageSize;
|
||||
}
|
||||
|
||||
isSearching() {
|
||||
@ -194,7 +196,7 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
|
||||
if (searching && this.didScroll) {
|
||||
this.resetPaging();
|
||||
}
|
||||
return !searching && this.ciphers.length > PageSize;
|
||||
return !searching && this.ciphers.length > this.pageSize;
|
||||
}
|
||||
|
||||
async resetPaging() {
|
||||
|
@ -23,6 +23,7 @@ import { FolderView } from 'jslib/models/view/folderView';
|
||||
import { CipherService } from 'jslib/abstractions/cipher.service';
|
||||
import { CollectionService } from 'jslib/abstractions/collection.service';
|
||||
import { FolderService } from 'jslib/abstractions/folder.service';
|
||||
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
||||
import { StateService } from 'jslib/abstractions/state.service';
|
||||
import { SyncService } from 'jslib/abstractions/sync.service';
|
||||
|
||||
@ -53,18 +54,21 @@ export class GroupingsComponent extends BaseGroupingsComponent implements OnInit
|
||||
private loadedTimeout: number;
|
||||
private selectedTimeout: number;
|
||||
private preventSelected = false;
|
||||
private noFolderListSize = 100;
|
||||
|
||||
constructor(collectionService: CollectionService, folderService: FolderService,
|
||||
private cipherService: CipherService, private router: Router,
|
||||
private ngZone: NgZone, private broadcasterService: BroadcasterService,
|
||||
private changeDetectorRef: ChangeDetectorRef, private route: ActivatedRoute,
|
||||
private stateService: StateService, private popupUtils: PopupUtilsService,
|
||||
private syncService: SyncService, private analytics: Angulartics2) {
|
||||
private syncService: SyncService, private analytics: Angulartics2,
|
||||
private platformUtilsService: PlatformUtilsService) {
|
||||
super(collectionService, folderService);
|
||||
this.noFolderListSize = platformUtilsService.isEdge() ? 50 : 100;
|
||||
}
|
||||
|
||||
get showNoFolderCiphers(): boolean {
|
||||
return this.noFolderCiphers != null && this.noFolderCiphers.length < 100 &&
|
||||
return this.noFolderCiphers != null && this.noFolderCiphers.length < this.noFolderListSize &&
|
||||
this.collections.length === 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user