1
0
mirror of https://github.com/bitwarden/browser synced 2025-01-26 19:25:10 +01:00

smaller list sizes on edge

This commit is contained in:
Kyle Spearrin 2018-04-13 23:22:20 -04:00
parent cfa0e1044f
commit 15792a1ae6
2 changed files with 14 additions and 8 deletions

View File

@ -19,6 +19,7 @@ import { CipherService } from 'jslib/abstractions/cipher.service';
import { CollectionService } from 'jslib/abstractions/collection.service'; import { CollectionService } from 'jslib/abstractions/collection.service';
import { FolderService } from 'jslib/abstractions/folder.service'; import { FolderService } from 'jslib/abstractions/folder.service';
import { I18nService } from 'jslib/abstractions/i18n.service'; import { I18nService } from 'jslib/abstractions/i18n.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { StateService } from 'jslib/abstractions/state.service'; import { StateService } from 'jslib/abstractions/state.service';
import { CipherType } from 'jslib/enums/cipherType'; 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'; import { PopupUtilsService } from '../services/popup-utils.service';
const ComponentId = 'CiphersComponent'; const ComponentId = 'CiphersComponent';
const PageSize = 100;
@Component({ @Component({
selector: 'app-vault-ciphers', selector: 'app-vault-ciphers',
@ -50,6 +50,7 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
private didScroll = false; private didScroll = false;
private selectedTimeout: number; private selectedTimeout: number;
private preventSelected = false; private preventSelected = false;
private pageSize = 100;
constructor(cipherService: CipherService, private route: ActivatedRoute, constructor(cipherService: CipherService, private route: ActivatedRoute,
private router: Router, private location: Location, 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 changeDetectorRef: ChangeDetectorRef, private stateService: StateService,
private popupUtils: PopupUtilsService, private i18nService: I18nService, private popupUtils: PopupUtilsService, private i18nService: I18nService,
private folderService: FolderService, private collectionService: CollectionService, private folderService: FolderService, private collectionService: CollectionService,
private analytics: Angulartics2) { private analytics: Angulartics2, private platformUtilsService: PlatformUtilsService) {
super(cipherService); super(cipherService);
this.pageSize = platformUtilsService.isEdge() ? 50 : 100;
} }
async ngOnInit() { async ngOnInit() {
@ -174,15 +176,15 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
} }
loadMore() { loadMore() {
if (this.ciphers.length <= PageSize) { if (this.ciphers.length <= this.pageSize) {
return; return;
} }
const pagedLength = this.pagedCiphers.length; const pagedLength = this.pagedCiphers.length;
if (this.ciphers.length > pagedLength) { 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() { isSearching() {
@ -194,7 +196,7 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
if (searching && this.didScroll) { if (searching && this.didScroll) {
this.resetPaging(); this.resetPaging();
} }
return !searching && this.ciphers.length > PageSize; return !searching && this.ciphers.length > this.pageSize;
} }
async resetPaging() { async resetPaging() {

View File

@ -23,6 +23,7 @@ import { FolderView } from 'jslib/models/view/folderView';
import { CipherService } from 'jslib/abstractions/cipher.service'; import { CipherService } from 'jslib/abstractions/cipher.service';
import { CollectionService } from 'jslib/abstractions/collection.service'; import { CollectionService } from 'jslib/abstractions/collection.service';
import { FolderService } from 'jslib/abstractions/folder.service'; import { FolderService } from 'jslib/abstractions/folder.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { StateService } from 'jslib/abstractions/state.service'; import { StateService } from 'jslib/abstractions/state.service';
import { SyncService } from 'jslib/abstractions/sync.service'; import { SyncService } from 'jslib/abstractions/sync.service';
@ -53,18 +54,21 @@ export class GroupingsComponent extends BaseGroupingsComponent implements OnInit
private loadedTimeout: number; private loadedTimeout: number;
private selectedTimeout: number; private selectedTimeout: number;
private preventSelected = false; private preventSelected = false;
private noFolderListSize = 100;
constructor(collectionService: CollectionService, folderService: FolderService, constructor(collectionService: CollectionService, folderService: FolderService,
private cipherService: CipherService, private router: Router, private cipherService: CipherService, private router: Router,
private ngZone: NgZone, private broadcasterService: BroadcasterService, private ngZone: NgZone, private broadcasterService: BroadcasterService,
private changeDetectorRef: ChangeDetectorRef, private route: ActivatedRoute, private changeDetectorRef: ChangeDetectorRef, private route: ActivatedRoute,
private stateService: StateService, private popupUtils: PopupUtilsService, private stateService: StateService, private popupUtils: PopupUtilsService,
private syncService: SyncService, private analytics: Angulartics2) { private syncService: SyncService, private analytics: Angulartics2,
private platformUtilsService: PlatformUtilsService) {
super(collectionService, folderService); super(collectionService, folderService);
this.noFolderListSize = platformUtilsService.isEdge() ? 50 : 100;
} }
get showNoFolderCiphers(): boolean { get showNoFolderCiphers(): boolean {
return this.noFolderCiphers != null && this.noFolderCiphers.length < 100 && return this.noFolderCiphers != null && this.noFolderCiphers.length < this.noFolderListSize &&
this.collections.length === 0; this.collections.length === 0;
} }