mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 01:03:35 +00:00
control save button enabled for sharing modal
This commit is contained in:
@@ -67,12 +67,14 @@ export class BulkShareComponent implements OnInit {
|
||||
|
||||
async submit() {
|
||||
const checkedCollectionIds = this.collections.filter((c) => (c as any).checked).map((c) => c.id);
|
||||
this.formPromise = this.cipherService.shareManyWithServer(this.shareableCiphers, this.organizationId,
|
||||
checkedCollectionIds);
|
||||
await this.formPromise;
|
||||
this.onShared.emit();
|
||||
this.analytics.eventTrack.next({ action: 'Bulk Shared Items' });
|
||||
this.toasterService.popAsync('success', null, this.i18nService.t('sharedItems'));
|
||||
try {
|
||||
this.formPromise = this.cipherService.shareManyWithServer(this.shareableCiphers, this.organizationId,
|
||||
checkedCollectionIds);
|
||||
await this.formPromise;
|
||||
this.onShared.emit();
|
||||
this.analytics.eventTrack.next({ action: 'Bulk Shared Items' });
|
||||
this.toasterService.popAsync('success', null, this.i18nService.t('sharedItems'));
|
||||
} catch { }
|
||||
}
|
||||
|
||||
check(c: CollectionView, select?: boolean) {
|
||||
@@ -83,4 +85,15 @@ export class BulkShareComponent implements OnInit {
|
||||
const collections = select ? this.collections : this.writeableCollections;
|
||||
collections.forEach((c) => this.check(c, select));
|
||||
}
|
||||
|
||||
get canSave() {
|
||||
if (this.shareableCiphers != null && this.shareableCiphers.length > 0 && this.collections != null) {
|
||||
for (let i = 0; i < this.collections.length; i++) {
|
||||
if ((this.collections[i] as any).checked) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user