2018-01-16 22:12:26 +01:00
|
|
|
import * as template from './vault.component.html';
|
|
|
|
|
2018-02-08 16:37:54 +01:00
|
|
|
import { Location } from '@angular/common';
|
2018-01-16 22:12:26 +01:00
|
|
|
import {
|
2018-02-08 21:58:47 +01:00
|
|
|
ChangeDetectorRef,
|
2018-01-16 22:12:26 +01:00
|
|
|
Component,
|
2018-01-29 15:33:43 +01:00
|
|
|
ComponentFactoryResolver,
|
2018-02-08 21:58:47 +01:00
|
|
|
NgZone,
|
2018-01-16 22:12:26 +01:00
|
|
|
OnInit,
|
2018-01-26 21:44:02 +01:00
|
|
|
ViewChild,
|
2018-01-29 15:33:43 +01:00
|
|
|
ViewContainerRef,
|
2018-01-16 22:12:26 +01:00
|
|
|
} from '@angular/core';
|
2018-01-25 17:21:08 +01:00
|
|
|
import {
|
|
|
|
ActivatedRoute,
|
|
|
|
Router,
|
|
|
|
} from '@angular/router';
|
|
|
|
|
2018-02-09 19:47:59 +01:00
|
|
|
import { ToasterService } from 'angular2-toaster';
|
|
|
|
import { Angulartics2 } from 'angulartics2';
|
|
|
|
|
2018-02-08 16:37:54 +01:00
|
|
|
import { ModalComponent } from '../modal.component';
|
2018-01-25 17:21:08 +01:00
|
|
|
|
2018-02-08 21:58:47 +01:00
|
|
|
import { BroadcasterService } from '../services/broadcaster.service';
|
|
|
|
|
2018-01-29 22:33:38 +01:00
|
|
|
import { AddEditComponent } from './add-edit.component';
|
2018-02-08 16:37:54 +01:00
|
|
|
import { AttachmentsComponent } from './attachments.component';
|
2018-01-26 21:44:02 +01:00
|
|
|
import { CiphersComponent } from './ciphers.component';
|
2018-01-30 21:40:06 +01:00
|
|
|
import { FolderAddEditComponent } from './folder-add-edit.component';
|
2018-01-27 14:52:39 +01:00
|
|
|
import { GroupingsComponent } from './groupings.component';
|
2018-01-29 15:33:43 +01:00
|
|
|
import { PasswordGeneratorComponent } from './password-generator.component';
|
2018-01-23 22:58:32 +01:00
|
|
|
|
2018-01-27 05:32:03 +01:00
|
|
|
import { CipherType } from 'jslib/enums/cipherType';
|
|
|
|
|
2018-01-24 18:20:01 +01:00
|
|
|
import { CipherView } from 'jslib/models/view/cipherView';
|
2018-01-27 05:32:03 +01:00
|
|
|
import { CollectionView } from 'jslib/models/view/collectionView';
|
|
|
|
import { FolderView } from 'jslib/models/view/folderView';
|
2018-01-24 18:20:01 +01:00
|
|
|
|
2018-01-30 03:54:39 +01:00
|
|
|
import { I18nService } from 'jslib/abstractions/i18n.service';
|
2018-02-09 21:49:00 +01:00
|
|
|
import { MessagingService } from 'jslib/abstractions/messaging.service';
|
2018-02-09 17:18:37 +01:00
|
|
|
import { SyncService } from 'jslib/abstractions/sync.service';
|
2018-01-30 03:54:39 +01:00
|
|
|
|
2018-02-09 21:49:00 +01:00
|
|
|
const SyncInterval = 6 * 60 * 60 * 1000; // 6 hours
|
|
|
|
|
2018-01-16 22:12:26 +01:00
|
|
|
@Component({
|
|
|
|
selector: 'app-vault',
|
|
|
|
template: template,
|
|
|
|
})
|
|
|
|
export class VaultComponent implements OnInit {
|
2018-01-29 22:33:38 +01:00
|
|
|
@ViewChild(AddEditComponent) addEditComponent: AddEditComponent;
|
2018-01-26 21:44:02 +01:00
|
|
|
@ViewChild(CiphersComponent) ciphersComponent: CiphersComponent;
|
2018-01-27 14:52:39 +01:00
|
|
|
@ViewChild(GroupingsComponent) groupingsComponent: GroupingsComponent;
|
2018-02-09 18:12:41 +01:00
|
|
|
@ViewChild('passwordGenerator', { read: ViewContainerRef }) passwordGeneratorModalRef: ViewContainerRef;
|
|
|
|
@ViewChild('attachments', { read: ViewContainerRef }) attachmentsModalRef: ViewContainerRef;
|
|
|
|
@ViewChild('folderAddEdit', { read: ViewContainerRef }) folderAddEditModalRef: ViewContainerRef;
|
2018-01-26 21:44:02 +01:00
|
|
|
|
2018-01-25 17:21:08 +01:00
|
|
|
action: string;
|
2018-01-27 05:56:43 +01:00
|
|
|
cipherId: string = null;
|
|
|
|
favorites: boolean = false;
|
|
|
|
type: CipherType = null;
|
|
|
|
folderId: string = null;
|
|
|
|
collectionId: string = null;
|
2018-02-08 21:58:47 +01:00
|
|
|
addType: CipherType = null;
|
2018-01-23 22:58:32 +01:00
|
|
|
|
2018-02-09 18:36:33 +01:00
|
|
|
private modal: ModalComponent = null;
|
2018-02-09 18:12:41 +01:00
|
|
|
|
2018-01-29 15:33:43 +01:00
|
|
|
constructor(private route: ActivatedRoute, private router: Router, private location: Location,
|
2018-02-08 21:58:47 +01:00
|
|
|
private componentFactoryResolver: ComponentFactoryResolver, private i18nService: I18nService,
|
|
|
|
private broadcasterService: BroadcasterService, private changeDetectorRef: ChangeDetectorRef,
|
2018-02-09 19:47:59 +01:00
|
|
|
private ngZone: NgZone, private syncService: SyncService, private analytics: Angulartics2,
|
2018-02-09 21:49:00 +01:00
|
|
|
private toasterService: ToasterService, private messagingService: MessagingService) {
|
2018-01-23 22:58:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
async ngOnInit() {
|
2018-02-08 21:58:47 +01:00
|
|
|
this.broadcasterService.subscribe((message: any) => {
|
|
|
|
this.ngZone.run(async () => {
|
|
|
|
let detectChanges = true;
|
|
|
|
|
|
|
|
switch (message.command) {
|
|
|
|
case 'newLogin':
|
|
|
|
this.addCipher(CipherType.Login);
|
|
|
|
break;
|
|
|
|
case 'newCard':
|
|
|
|
this.addCipher(CipherType.Card);
|
|
|
|
break;
|
|
|
|
case 'newIdentity':
|
|
|
|
this.addCipher(CipherType.Identity);
|
|
|
|
break;
|
|
|
|
case 'newSecureNote':
|
|
|
|
this.addCipher(CipherType.SecureNote);
|
|
|
|
break;
|
|
|
|
case 'newFolder':
|
|
|
|
await this.addFolder();
|
|
|
|
break;
|
2018-02-09 18:12:41 +01:00
|
|
|
case 'focusSearch':
|
|
|
|
(document.querySelector('#search') as HTMLInputElement).focus();
|
|
|
|
detectChanges = false;
|
|
|
|
break;
|
|
|
|
case 'openPasswordGenerator':
|
|
|
|
await this.openPasswordGenerator(false);
|
|
|
|
break;
|
2018-02-09 19:47:59 +01:00
|
|
|
case 'syncVault':
|
|
|
|
try {
|
|
|
|
await this.syncService.fullSync(true);
|
|
|
|
this.toasterService.popAsync('success', null, this.i18nService.t('syncingComplete'));
|
|
|
|
this.analytics.eventTrack.next({ action: 'Synced Full' });
|
|
|
|
} catch {
|
|
|
|
this.toasterService.popAsync('error', null, this.i18nService.t('syncingFailed'));
|
|
|
|
}
|
|
|
|
break;
|
2018-02-09 21:49:00 +01:00
|
|
|
case 'checkSyncVault':
|
|
|
|
try {
|
|
|
|
const lastSync = await this.syncService.getLastSync();
|
|
|
|
let lastSyncAgo = SyncInterval + 1;
|
|
|
|
if (lastSync != null) {
|
|
|
|
lastSyncAgo = new Date().getTime() - lastSync.getTime();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lastSyncAgo >= SyncInterval) {
|
|
|
|
await this.syncService.fullSync(false);
|
|
|
|
}
|
|
|
|
} catch { }
|
|
|
|
|
|
|
|
this.messagingService.send('scheduleNextSync');
|
|
|
|
break;
|
2018-02-09 19:47:59 +01:00
|
|
|
case 'syncCompleted':
|
2018-02-09 21:49:00 +01:00
|
|
|
if (message.successfully) {
|
|
|
|
await this.load();
|
|
|
|
}
|
2018-02-09 19:47:59 +01:00
|
|
|
break;
|
2018-02-08 21:58:47 +01:00
|
|
|
default:
|
|
|
|
detectChanges = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (detectChanges) {
|
|
|
|
this.changeDetectorRef.detectChanges();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2018-02-09 19:47:59 +01:00
|
|
|
if (!this.syncService.syncInProgress) {
|
|
|
|
await this.load();
|
2018-02-09 17:18:37 +01:00
|
|
|
}
|
2018-02-09 19:47:59 +01:00
|
|
|
}
|
2018-02-09 17:18:37 +01:00
|
|
|
|
2018-02-09 19:47:59 +01:00
|
|
|
async load() {
|
2018-01-27 05:56:43 +01:00
|
|
|
this.route.queryParams.subscribe(async (params) => {
|
2018-02-09 19:47:59 +01:00
|
|
|
await this.groupingsComponent.load();
|
2018-01-27 05:56:43 +01:00
|
|
|
|
2018-02-09 19:47:59 +01:00
|
|
|
if (params == null) {
|
|
|
|
this.groupingsComponent.selectedAll = true;
|
|
|
|
await this.ciphersComponent.load();
|
|
|
|
return;
|
|
|
|
}
|
2018-02-09 18:12:41 +01:00
|
|
|
|
2018-02-09 19:47:59 +01:00
|
|
|
if (params.cipherId) {
|
|
|
|
const cipherView = new CipherView();
|
|
|
|
cipherView.id = params.cipherId;
|
|
|
|
if (params.action === 'edit') {
|
|
|
|
this.editCipher(cipherView);
|
|
|
|
} else {
|
|
|
|
this.viewCipher(cipherView);
|
|
|
|
}
|
|
|
|
} else if (params.action === 'add') {
|
|
|
|
this.addCipher();
|
|
|
|
}
|
2018-02-09 17:18:37 +01:00
|
|
|
|
2018-02-09 19:47:59 +01:00
|
|
|
if (params.favorites) {
|
|
|
|
this.groupingsComponent.selectedFavorites = true;
|
|
|
|
await this.filterFavorites();
|
|
|
|
} else if (params.type) {
|
|
|
|
const t = parseInt(params.type, null);
|
|
|
|
this.groupingsComponent.selectedType = t;
|
|
|
|
await this.filterCipherType(t);
|
|
|
|
} else if (params.folderId) {
|
|
|
|
this.groupingsComponent.selectedFolder = true;
|
|
|
|
this.groupingsComponent.selectedFolderId = params.folderId;
|
|
|
|
await this.filterFolder(params.folderId);
|
|
|
|
} else if (params.collectionId) {
|
|
|
|
this.groupingsComponent.selectedCollectionId = params.collectionId;
|
|
|
|
await this.filterCollection(params.collectionId);
|
2018-01-27 05:56:43 +01:00
|
|
|
} else {
|
2018-02-09 19:47:59 +01:00
|
|
|
this.groupingsComponent.selectedAll = true;
|
|
|
|
await this.ciphersComponent.load();
|
2018-01-27 05:56:43 +01:00
|
|
|
}
|
2018-02-09 19:47:59 +01:00
|
|
|
});
|
2018-01-16 22:12:26 +01:00
|
|
|
}
|
2018-01-24 06:06:05 +01:00
|
|
|
|
2018-01-26 20:56:54 +01:00
|
|
|
viewCipher(cipher: CipherView) {
|
|
|
|
if (this.action === 'view' && this.cipherId === cipher.id) {
|
2018-01-25 17:28:52 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-01-26 20:56:54 +01:00
|
|
|
this.cipherId = cipher.id;
|
2018-01-25 17:21:08 +01:00
|
|
|
this.action = 'view';
|
2018-01-27 14:52:39 +01:00
|
|
|
this.go();
|
2018-01-24 06:06:05 +01:00
|
|
|
}
|
2018-01-24 23:41:57 +01:00
|
|
|
|
2018-01-26 20:56:54 +01:00
|
|
|
editCipher(cipher: CipherView) {
|
|
|
|
if (this.action === 'edit' && this.cipherId === cipher.id) {
|
2018-01-25 17:28:52 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-01-26 20:56:54 +01:00
|
|
|
this.cipherId = cipher.id;
|
2018-01-25 17:21:08 +01:00
|
|
|
this.action = 'edit';
|
2018-01-27 14:52:39 +01:00
|
|
|
this.go();
|
2018-01-24 23:41:57 +01:00
|
|
|
}
|
|
|
|
|
2018-02-08 21:58:47 +01:00
|
|
|
addCipher(type: CipherType = null) {
|
2018-01-25 17:28:52 +01:00
|
|
|
if (this.action === 'add') {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-02-08 21:58:47 +01:00
|
|
|
this.addType = type;
|
2018-01-25 17:21:08 +01:00
|
|
|
this.action = 'add';
|
2018-01-26 20:56:54 +01:00
|
|
|
this.cipherId = null;
|
2018-01-27 14:52:39 +01:00
|
|
|
this.go();
|
2018-01-26 20:56:54 +01:00
|
|
|
}
|
|
|
|
|
2018-01-31 23:20:27 +01:00
|
|
|
async savedCipher(cipher: CipherView) {
|
2018-01-26 20:56:54 +01:00
|
|
|
this.cipherId = cipher.id;
|
|
|
|
this.action = 'view';
|
2018-01-27 14:52:39 +01:00
|
|
|
this.go();
|
2018-01-31 23:20:27 +01:00
|
|
|
await this.ciphersComponent.refresh();
|
2018-01-26 20:56:54 +01:00
|
|
|
}
|
|
|
|
|
2018-01-31 23:20:27 +01:00
|
|
|
async deletedCipher(cipher: CipherView) {
|
2018-01-26 21:44:02 +01:00
|
|
|
this.cipherId = null;
|
|
|
|
this.action = null;
|
2018-01-27 14:52:39 +01:00
|
|
|
this.go();
|
2018-01-31 23:20:27 +01:00
|
|
|
await this.ciphersComponent.refresh();
|
2018-01-26 20:56:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
editCipherAttachments(cipher: CipherView) {
|
2018-02-09 18:36:33 +01:00
|
|
|
if (this.modal != null) {
|
|
|
|
this.modal.close();
|
2018-02-09 18:12:41 +01:00
|
|
|
}
|
|
|
|
|
2018-01-30 05:19:55 +01:00
|
|
|
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
2018-02-09 18:36:33 +01:00
|
|
|
this.modal = this.attachmentsModalRef.createComponent(factory).instance;
|
|
|
|
const childComponent = this.modal.show<AttachmentsComponent>(AttachmentsComponent, this.attachmentsModalRef);
|
2018-01-26 20:56:54 +01:00
|
|
|
|
2018-01-30 05:19:55 +01:00
|
|
|
childComponent.cipherId = cipher.id;
|
2018-02-09 18:12:41 +01:00
|
|
|
|
2018-02-09 18:36:33 +01:00
|
|
|
this.modal.onClosed.subscribe(() => {
|
|
|
|
this.modal = null;
|
2018-02-09 18:12:41 +01:00
|
|
|
});
|
2018-01-26 20:56:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
cancelledAddEdit(cipher: CipherView) {
|
|
|
|
this.cipherId = cipher.id;
|
|
|
|
this.action = this.cipherId != null ? 'view' : null;
|
2018-01-27 14:52:39 +01:00
|
|
|
this.go();
|
2018-01-25 17:21:08 +01:00
|
|
|
}
|
|
|
|
|
2018-01-27 05:32:03 +01:00
|
|
|
async clearGroupingFilters() {
|
2018-01-30 03:54:39 +01:00
|
|
|
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchVault');
|
2018-01-27 05:32:03 +01:00
|
|
|
await this.ciphersComponent.load();
|
2018-01-27 05:56:43 +01:00
|
|
|
this.clearFilters();
|
|
|
|
this.go();
|
2018-01-27 05:32:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
async filterFavorites() {
|
2018-01-30 03:54:39 +01:00
|
|
|
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchFavorites');
|
2018-01-27 05:32:03 +01:00
|
|
|
await this.ciphersComponent.load((c) => c.favorite);
|
2018-01-27 05:56:43 +01:00
|
|
|
this.clearFilters();
|
|
|
|
this.favorites = true;
|
|
|
|
this.go();
|
2018-01-27 05:32:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
async filterCipherType(type: CipherType) {
|
2018-01-30 03:54:39 +01:00
|
|
|
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchType');
|
2018-01-27 05:32:03 +01:00
|
|
|
await this.ciphersComponent.load((c) => c.type === type);
|
2018-01-27 05:56:43 +01:00
|
|
|
this.clearFilters();
|
|
|
|
this.type = type;
|
|
|
|
this.go();
|
|
|
|
}
|
|
|
|
|
|
|
|
async filterFolder(folderId: string) {
|
|
|
|
folderId = folderId === 'none' ? null : folderId;
|
2018-01-30 03:54:39 +01:00
|
|
|
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchFolder');
|
2018-01-27 05:56:43 +01:00
|
|
|
await this.ciphersComponent.load((c) => c.folderId === folderId);
|
|
|
|
this.clearFilters();
|
|
|
|
this.folderId = folderId == null ? 'none' : folderId;
|
|
|
|
this.go();
|
2018-01-27 05:32:03 +01:00
|
|
|
}
|
|
|
|
|
2018-01-27 05:56:43 +01:00
|
|
|
async filterCollection(collectionId: string) {
|
2018-01-30 03:54:39 +01:00
|
|
|
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchCollection');
|
2018-01-27 05:56:43 +01:00
|
|
|
await this.ciphersComponent.load((c) => c.collectionIds.indexOf(collectionId) > -1);
|
|
|
|
this.clearFilters();
|
|
|
|
this.collectionId = collectionId;
|
|
|
|
this.go();
|
2018-01-27 05:32:03 +01:00
|
|
|
}
|
|
|
|
|
2018-02-09 18:12:41 +01:00
|
|
|
async openPasswordGenerator(showSelect: boolean) {
|
2018-02-09 18:36:33 +01:00
|
|
|
if (this.modal != null) {
|
|
|
|
this.modal.close();
|
2018-02-09 18:12:41 +01:00
|
|
|
}
|
|
|
|
|
2018-01-30 05:19:55 +01:00
|
|
|
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
2018-02-09 18:36:33 +01:00
|
|
|
this.modal = this.passwordGeneratorModalRef.createComponent(factory).instance;
|
|
|
|
const childComponent = this.modal.show<PasswordGeneratorComponent>(PasswordGeneratorComponent,
|
2018-02-09 18:12:41 +01:00
|
|
|
this.passwordGeneratorModalRef);
|
2018-01-29 22:33:38 +01:00
|
|
|
|
2018-02-09 18:12:41 +01:00
|
|
|
childComponent.showSelect = showSelect;
|
2018-01-29 22:33:38 +01:00
|
|
|
childComponent.onSelected.subscribe((password: string) => {
|
2018-02-09 18:36:33 +01:00
|
|
|
this.modal.close();
|
2018-01-29 22:33:38 +01:00
|
|
|
if (this.addEditComponent != null && this.addEditComponent.cipher != null &&
|
|
|
|
this.addEditComponent.cipher.login != null) {
|
|
|
|
this.addEditComponent.cipher.login.password = password;
|
|
|
|
}
|
|
|
|
});
|
2018-02-09 18:12:41 +01:00
|
|
|
|
2018-02-09 18:36:33 +01:00
|
|
|
this.modal.onClosed.subscribe(() => {
|
|
|
|
this.modal = null;
|
2018-02-09 18:12:41 +01:00
|
|
|
});
|
2018-01-29 15:33:43 +01:00
|
|
|
}
|
|
|
|
|
2018-01-30 21:40:06 +01:00
|
|
|
async addFolder() {
|
2018-02-09 18:36:33 +01:00
|
|
|
if (this.modal != null) {
|
|
|
|
this.modal.close();
|
|
|
|
}
|
|
|
|
|
2018-01-30 21:40:06 +01:00
|
|
|
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
2018-02-09 18:36:33 +01:00
|
|
|
this.modal = this.folderAddEditModalRef.createComponent(factory).instance;
|
|
|
|
const childComponent = this.modal.show<FolderAddEditComponent>(
|
2018-02-09 18:12:41 +01:00
|
|
|
FolderAddEditComponent, this.folderAddEditModalRef);
|
2018-01-30 21:40:06 +01:00
|
|
|
|
|
|
|
childComponent.folderId = null;
|
|
|
|
childComponent.onSavedFolder.subscribe(async (folder: FolderView) => {
|
2018-02-09 18:36:33 +01:00
|
|
|
this.modal.close();
|
2018-01-30 21:40:06 +01:00
|
|
|
await this.groupingsComponent.loadFolders();
|
|
|
|
});
|
2018-02-09 18:12:41 +01:00
|
|
|
|
2018-02-09 18:36:33 +01:00
|
|
|
this.modal.onClosed.subscribe(() => {
|
|
|
|
this.modal = null;
|
2018-02-09 18:12:41 +01:00
|
|
|
});
|
2018-01-30 21:40:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
async editFolder(folderId: string) {
|
2018-02-09 18:36:33 +01:00
|
|
|
if (this.modal != null) {
|
|
|
|
this.modal.close();
|
|
|
|
}
|
|
|
|
|
2018-01-30 21:40:06 +01:00
|
|
|
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
2018-02-09 18:36:33 +01:00
|
|
|
this.modal = this.folderAddEditModalRef.createComponent(factory).instance;
|
|
|
|
const childComponent = this.modal.show<FolderAddEditComponent>(
|
2018-02-09 18:12:41 +01:00
|
|
|
FolderAddEditComponent, this.folderAddEditModalRef);
|
2018-01-30 21:40:06 +01:00
|
|
|
|
|
|
|
childComponent.folderId = folderId;
|
|
|
|
childComponent.onSavedFolder.subscribe(async (folder: FolderView) => {
|
2018-02-09 18:36:33 +01:00
|
|
|
this.modal.close();
|
2018-01-30 21:40:06 +01:00
|
|
|
await this.groupingsComponent.loadFolders();
|
|
|
|
});
|
|
|
|
childComponent.onDeletedFolder.subscribe(async (folder: FolderView) => {
|
2018-02-09 18:36:33 +01:00
|
|
|
this.modal.close();
|
2018-01-30 21:40:06 +01:00
|
|
|
await this.groupingsComponent.loadFolders();
|
|
|
|
});
|
2018-02-09 18:12:41 +01:00
|
|
|
|
2018-02-09 18:36:33 +01:00
|
|
|
this.modal.onClosed.subscribe(() => {
|
|
|
|
this.modal = null;
|
2018-02-09 18:12:41 +01:00
|
|
|
});
|
2018-01-30 21:40:06 +01:00
|
|
|
}
|
|
|
|
|
2018-01-27 05:56:43 +01:00
|
|
|
private clearFilters() {
|
|
|
|
this.folderId = null;
|
|
|
|
this.collectionId = null;
|
|
|
|
this.favorites = false;
|
|
|
|
this.type = null;
|
2018-01-27 05:32:03 +01:00
|
|
|
}
|
|
|
|
|
2018-01-27 05:56:43 +01:00
|
|
|
private go(queryParams: any = null) {
|
|
|
|
if (queryParams == null) {
|
|
|
|
queryParams = {
|
|
|
|
action: this.action,
|
|
|
|
cipherId: this.cipherId,
|
|
|
|
favorites: this.favorites ? true : null,
|
|
|
|
type: this.type,
|
|
|
|
folderId: this.folderId,
|
|
|
|
collectionId: this.collectionId,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2018-01-25 17:21:08 +01:00
|
|
|
const url = this.router.createUrlTree(['vault'], { queryParams: queryParams }).toString();
|
|
|
|
this.location.go(url);
|
2018-01-24 23:41:57 +01:00
|
|
|
}
|
2018-01-16 22:12:26 +01:00
|
|
|
}
|