1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-04 17:43:39 +00:00

group add/edit/delete

This commit is contained in:
Kyle Spearrin
2018-07-09 16:27:54 -04:00
parent b774091b83
commit ecfecd295a
13 changed files with 383 additions and 46 deletions

View File

@@ -75,14 +75,12 @@ export class BulkShareComponent implements OnInit {
this.toasterService.popAsync('success', null, this.i18nService.t('sharedItems'));
}
check(c: CollectionView) {
(c as any).checked = !(c as any).checked;
check(c: CollectionView, select?: boolean) {
(c as any).checked = select == null ? !(c as any).checked : select;
}
selectAll(select: false) {
selectAll(select: boolean) {
const collections = select ? this.collections : this.writeableCollections;
for (const c of collections) {
(c as any).checked = select;
}
collections.forEach((c) => this.check(c, select));
}
}

View File

@@ -38,8 +38,8 @@ export class CiphersComponent extends BaseCiphersComponent {
super(cipherService);
}
checkCipher(c: CipherView) {
(c as any).checked = !(c as any).checked;
checkCipher(c: CipherView, select?: boolean) {
(c as any).checked = select == null ? !(c as any).checked : select;
}
selectAll(select: boolean) {
@@ -48,7 +48,7 @@ export class CiphersComponent extends BaseCiphersComponent {
}
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;
this.checkCipher(this.ciphers[i], select);
}
}

View File

@@ -15,10 +15,10 @@
<div class="d-flex">
<h3>{{'collections' | i18n}}</h3>
<small class="ml-auto d-flex">
<button type="button" appBlurClick (click)="selectAll()" class="btn btn-link btn-sm py-0">
<button type="button" appBlurClick (click)="selectAll(true)" class="btn btn-link btn-sm py-0">
{{'selectAll' | i18n}}
</button>
<button type="button" appBlurClick (click)="unselectAll()" class="btn btn-link btn-sm py-0">
<button type="button" appBlurClick (click)="selectAll(false)" class="btn btn-link btn-sm py-0">
{{'unselectAll' | i18n}}
</button>
</small>

View File

@@ -44,7 +44,7 @@ export class CollectionsComponent implements OnInit, OnDestroy {
this.cipher = await this.cipherDomain.decrypt();
this.collections = await this.loadCollections();
this.unselectAll();
this.selectAll(false);
if (this.collectionIds != null) {
this.collections.forEach((c) => {
(c as any).checked = this.collectionIds.indexOf(c.id) > -1;
@@ -53,7 +53,7 @@ export class CollectionsComponent implements OnInit, OnDestroy {
}
ngOnDestroy() {
this.unselectAll();
this.selectAll(false);
}
async submit() {
@@ -67,20 +67,12 @@ export class CollectionsComponent implements OnInit, OnDestroy {
this.toasterService.popAsync('success', null, this.i18nService.t('editedItem'));
}
check(c: CollectionView) {
(c as any).checked = !(c as any).checked;
check(c: CollectionView, select?: boolean) {
(c as any).checked = select == null ? !(c as any).checked : select;
}
selectAll() {
for (const c of this.collections) {
(c as any).checked = true;
}
}
unselectAll() {
for (const c of this.collections) {
(c as any).checked = false;
}
selectAll(select: boolean) {
this.collections.forEach((c) => this.check(c, select));
}
protected loadCipher() {

View File

@@ -87,14 +87,12 @@ export class ShareComponent implements OnInit, OnDestroy {
await this.formPromise;
}
check(c: CollectionView) {
(c as any).checked = !(c as any).checked;
check(c: CollectionView, select?: boolean) {
(c as any).checked = select == null ? !(c as any).checked : select;
}
selectAll(select: false) {
const collections = select ? this.collections : this.writeableCollections;
for (const c of collections) {
(c as any).checked = select;
}
collections.forEach((c) => this.check(c, select));
}
}