1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 07:43:35 +00:00

bulk actions stubbed out. bulk delete implemented

This commit is contained in:
Kyle Spearrin
2018-06-12 17:11:24 -04:00
parent 3666ee5a87
commit 314ab61349
7 changed files with 146 additions and 8 deletions

View File

@@ -17,6 +17,8 @@ import { CipherType } from 'jslib/enums/cipherType';
import { CipherView } from 'jslib/models/view/cipherView';
const MaxCheckedCount = 500;
@Component({
selector: 'app-vault-ciphers',
templateUrl: 'ciphers.component.html',
@@ -25,6 +27,7 @@ export class CiphersComponent extends BaseCiphersComponent {
@Output() onAttachmentsClicked = new EventEmitter<CipherView>();
@Output() onShareClicked = new EventEmitter<CipherView>();
@Output() onCollectionsClicked = new EventEmitter<CipherView>();
cipherType = CipherType;
constructor(cipherService: CipherService, private analytics: Angulartics2,
@@ -37,6 +40,23 @@ export class CiphersComponent extends BaseCiphersComponent {
(c as any).checked = !(c as any).checked;
}
selectAll(select: boolean) {
if (select) {
this.selectAll(false);
}
const selectCount = select && this.ciphers.length > MaxCheckedCount ? MaxCheckedCount : this.ciphers.length;
for (let i = 0; i < selectCount; i++) {
(this.ciphers[i] as any).checked = select;
}
}
getSelected(): string[] {
if (this.ciphers == null) {
return [];
}
return this.ciphers.filter((c) => !!(c as any).checked).map((c) => c.id);
}
attachments(c: CipherView) {
this.onAttachmentsClicked.emit(c);
}