filter ciphers before doing select all, resolves #227
This commit is contained in:
parent
229b9cf40a
commit
15fc4e5f2d
|
@ -18,6 +18,8 @@ import { CipherType } from 'jslib/enums/cipherType';
|
|||
|
||||
import { CipherView } from 'jslib/models/view/cipherView';
|
||||
|
||||
import { SearchCiphersPipe } from 'jslib/angular/pipes/search-ciphers.pipe';
|
||||
|
||||
const MaxCheckedCount = 500;
|
||||
|
||||
@Component({
|
||||
|
@ -32,10 +34,13 @@ export class CiphersComponent extends BaseCiphersComponent {
|
|||
|
||||
cipherType = CipherType;
|
||||
|
||||
private searchPipe: SearchCiphersPipe;
|
||||
|
||||
constructor(cipherService: CipherService, protected analytics: Angulartics2,
|
||||
protected toasterService: ToasterService, protected i18nService: I18nService,
|
||||
protected platformUtilsService: PlatformUtilsService) {
|
||||
super(cipherService);
|
||||
this.searchPipe = new SearchCiphersPipe(platformUtilsService);
|
||||
}
|
||||
|
||||
checkCipher(c: CipherView, select?: boolean) {
|
||||
|
@ -46,9 +51,14 @@ export class CiphersComponent extends BaseCiphersComponent {
|
|||
if (select) {
|
||||
this.selectAll(false);
|
||||
}
|
||||
const selectCount = select && this.ciphers.length > MaxCheckedCount ? MaxCheckedCount : this.ciphers.length;
|
||||
let filteredCiphers = this.ciphers;
|
||||
if (select) {
|
||||
filteredCiphers = this.searchPipe.transform(this.ciphers, this.searchText);
|
||||
}
|
||||
const selectCount = select && filteredCiphers.length > MaxCheckedCount ?
|
||||
MaxCheckedCount : filteredCiphers.length;
|
||||
for (let i = 0; i < selectCount; i++) {
|
||||
this.checkCipher(this.ciphers[i], select);
|
||||
this.checkCipher(filteredCiphers[i], select);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue