- |
+ |
|
@@ -58,9 +58,8 @@
{{'clone' | i18n}}
-
+
{{'share' | i18n}}
diff --git a/src/app/vault/ciphers.component.ts b/src/app/vault/ciphers.component.ts
index a13406690d2..5a06fc3413f 100644
--- a/src/app/vault/ciphers.component.ts
+++ b/src/app/vault/ciphers.component.ts
@@ -50,36 +50,11 @@ export class CiphersComponent extends BaseCiphersComponent implements OnDestroy
this.selectAll(false);
}
- checkCipher(c: CipherView, select?: boolean) {
- (c as any).checked = select == null ? !(c as any).checked : select;
- }
-
launch(uri: string) {
this.platformUtilsService.eventTrack('Launched Login URI');
this.platformUtilsService.launchUri(uri);
}
- 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.checkCipher(this.ciphers[i], select);
- }
- }
-
- getSelected(): CipherView[] {
- if (this.ciphers == null) {
- return [];
- }
- return this.ciphers.filter((c) => !!(c as any).checked);
- }
-
- getSelectedIds(): string[] {
- return this.getSelected().map((c) => c.id);
- }
-
attachments(c: CipherView) {
this.onAttachmentsClicked.emit(c);
}
@@ -159,6 +134,33 @@ export class CiphersComponent extends BaseCiphersComponent implements OnDestroy
}
}
+ 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.checkCipher(this.ciphers[i], select);
+ }
+ }
+
+ checkCipher(c: CipherView, select?: boolean) {
+ (c as any).checked = select == null ? !(c as any).checked : select;
+ }
+
+ getSelected(): CipherView[] {
+ if (this.ciphers == null) {
+ return [];
+ }
+ return this.ciphers.filter((c) => !!(c as any).checked);
+ }
+
+ getSelectedIds(): string[] {
+ return this.getSelected().map((c) => c.id);
+ }
+
protected deleteCipher(id: string, permanent: boolean) {
return permanent ? this.cipherService.deleteWithServer(id) : this.cipherService.softDeleteWithServer(id);
}
diff --git a/src/app/vault/vault.component.html b/src/app/vault/vault.component.html
index 3b5ace702e8..838f17f921b 100644
--- a/src/app/vault/vault.component.html
+++ b/src/app/vault/vault.component.html
@@ -21,40 +21,8 @@
-
-
-
-
+
+
@@ -122,8 +90,4 @@
-
-
-
-
diff --git a/src/app/vault/vault.component.ts b/src/app/vault/vault.component.ts
index ee3705732d7..3d3024bc55a 100644
--- a/src/app/vault/vault.component.ts
+++ b/src/app/vault/vault.component.ts
@@ -13,8 +13,6 @@ import {
Router,
} from '@angular/router';
-import { ToasterService } from 'angular2-toaster';
-
import { CipherType } from 'jslib/enums/cipherType';
import { CipherView } from 'jslib/models/view/cipherView';
@@ -25,10 +23,6 @@ import { OrganizationsComponent } from '../settings/organizations.component';
import { UpdateKeyComponent } from '../settings/update-key.component';
import { AddEditComponent } from './add-edit.component';
import { AttachmentsComponent } from './attachments.component';
-import { BulkDeleteComponent } from './bulk-delete.component';
-import { BulkMoveComponent } from './bulk-move.component';
-import { BulkRestoreComponent } from './bulk-restore.component';
-import { BulkShareComponent } from './bulk-share.component';
import { CiphersComponent } from './ciphers.component';
import { CollectionsComponent } from './collections.component';
import { FolderAddEditComponent } from './folder-add-edit.component';
@@ -60,10 +54,6 @@ export class VaultComponent implements OnInit, OnDestroy {
@ViewChild('cipherAddEdit', { read: ViewContainerRef }) cipherAddEditModalRef: ViewContainerRef;
@ViewChild('share', { read: ViewContainerRef }) shareModalRef: ViewContainerRef;
@ViewChild('collections', { read: ViewContainerRef }) collectionsModalRef: ViewContainerRef;
- @ViewChild('bulkDeleteTemplate', { read: ViewContainerRef }) bulkDeleteModalRef: ViewContainerRef;
- @ViewChild('bulkRestoreTemplate', { read: ViewContainerRef }) bulkRestoreModalRef: ViewContainerRef;
- @ViewChild('bulkMoveTemplate', { read: ViewContainerRef }) bulkMoveModalRef: ViewContainerRef;
- @ViewChild('bulkShareTemplate', { read: ViewContainerRef }) bulkShareModalRef: ViewContainerRef;
@ViewChild('updateKeyTemplate', { read: ViewContainerRef }) updateKeyModalRef: ViewContainerRef;
favorites: boolean = false;
@@ -76,15 +66,15 @@ export class VaultComponent implements OnInit, OnDestroy {
showPremiumCallout = false;
deleted: boolean = false;
- private modal: ModalComponent = null;
+ modal: ModalComponent = null;
constructor(private syncService: SyncService, private route: ActivatedRoute,
private router: Router, private changeDetectorRef: ChangeDetectorRef,
private i18nService: I18nService, private componentFactoryResolver: ComponentFactoryResolver,
private tokenService: TokenService, private cryptoService: CryptoService,
private messagingService: MessagingService, private userService: UserService,
- private platformUtilsService: PlatformUtilsService, private toasterService: ToasterService,
- private broadcasterService: BroadcasterService, private ngZone: NgZone) { }
+ private platformUtilsService: PlatformUtilsService, private broadcasterService: BroadcasterService,
+ private ngZone: NgZone) { }
async ngOnInit() {
this.showVerifyEmail = !(await this.tokenService.getEmailVerified());
@@ -391,119 +381,6 @@ export class VaultComponent implements OnInit, OnDestroy {
component.cloneMode = true;
}
- bulkDelete() {
- const selectedIds = this.ciphersComponent.getSelectedIds();
- if (selectedIds.length === 0) {
- this.toasterService.popAsync('error', this.i18nService.t('errorOccurred'),
- this.i18nService.t('nothingSelected'));
- return;
- }
-
- if (this.modal != null) {
- this.modal.close();
- }
-
- const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
- this.modal = this.bulkDeleteModalRef.createComponent(factory).instance;
- const childComponent = this.modal.show (BulkDeleteComponent, this.bulkDeleteModalRef);
-
- childComponent.permanent = this.deleted;
- childComponent.cipherIds = selectedIds;
- childComponent.onDeleted.subscribe(async () => {
- this.modal.close();
- await this.ciphersComponent.refresh();
- });
-
- this.modal.onClosed.subscribe(() => {
- this.modal = null;
- });
- }
-
- bulkRestore() {
- const selectedIds = this.ciphersComponent.getSelectedIds();
- if (selectedIds.length === 0) {
- this.toasterService.popAsync('error', this.i18nService.t('errorOccurred'),
- this.i18nService.t('nothingSelected'));
- return;
- }
-
- if (this.modal != null) {
- this.modal.close();
- }
-
- const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
- this.modal = this.bulkRestoreModalRef.createComponent(factory).instance;
- const childComponent = this.modal.show(BulkRestoreComponent, this.bulkRestoreModalRef);
-
- childComponent.cipherIds = selectedIds;
- childComponent.onRestored.subscribe(async () => {
- this.modal.close();
- await this.ciphersComponent.refresh();
- });
-
- this.modal.onClosed.subscribe(() => {
- this.modal = null;
- });
- }
-
- bulkShare() {
- const selectedCiphers = this.ciphersComponent.getSelected();
- if (selectedCiphers.length === 0) {
- this.toasterService.popAsync('error', this.i18nService.t('errorOccurred'),
- this.i18nService.t('nothingSelected'));
- return;
- }
-
- if (this.modal != null) {
- this.modal.close();
- }
-
- const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
- this.modal = this.bulkShareModalRef.createComponent(factory).instance;
- const childComponent = this.modal.show(BulkShareComponent, this.bulkShareModalRef);
-
- childComponent.ciphers = selectedCiphers;
- childComponent.onShared.subscribe(async () => {
- this.modal.close();
- await this.ciphersComponent.refresh();
- });
-
- this.modal.onClosed.subscribe(async () => {
- this.modal = null;
- });
- }
-
- bulkMove() {
- const selectedIds = this.ciphersComponent.getSelectedIds();
- if (selectedIds.length === 0) {
- this.toasterService.popAsync('error', this.i18nService.t('errorOccurred'),
- this.i18nService.t('nothingSelected'));
- return;
- }
-
- if (this.modal != null) {
- this.modal.close();
- }
-
- const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
- this.modal = this.bulkMoveModalRef.createComponent(factory).instance;
- const childComponent = this.modal.show(BulkMoveComponent, this.bulkMoveModalRef);
-
- childComponent.cipherIds = selectedIds;
- childComponent.onMoved.subscribe(async () => {
- this.modal.close();
- await this.ciphersComponent.refresh();
- });
-
- this.modal.onClosed.subscribe(() => {
- this.modal = null;
- });
- }
-
- selectAll(select: boolean) {
- this.ciphersComponent.selectAll(select);
- }
-
updateKey() {
if (this.modal != null) {
this.modal.close();
|