1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00

modal component

This commit is contained in:
Kyle Spearrin
2018-01-29 09:33:43 -05:00
parent 752e9a726a
commit c50b478a4d
9 changed files with 550 additions and 2 deletions

View File

@@ -2,8 +2,10 @@ import * as template from './vault.component.html';
import {
Component,
ComponentFactoryResolver,
OnInit,
ViewChild,
ViewContainerRef,
} from '@angular/core';
import {
@@ -15,6 +17,8 @@ import { Location } from '@angular/common';
import { CiphersComponent } from './ciphers.component';
import { GroupingsComponent } from './groupings.component';
import { PasswordGeneratorComponent } from './password-generator.component';
import { ModalComponent } from '../modal.component';
import { CipherType } from 'jslib/enums/cipherType';
@@ -29,6 +33,7 @@ import { FolderView } from 'jslib/models/view/folderView';
export class VaultComponent implements OnInit {
@ViewChild(CiphersComponent) ciphersComponent: CiphersComponent;
@ViewChild(GroupingsComponent) groupingsComponent: GroupingsComponent;
@ViewChild('passwordGenerator', { read: ViewContainerRef }) passwordGeneratorModal: ViewContainerRef;
action: string;
cipherId: string = null;
@@ -37,7 +42,8 @@ export class VaultComponent implements OnInit {
folderId: string = null;
collectionId: string = null;
constructor(private route: ActivatedRoute, private router: Router, private location: Location) {
constructor(private route: ActivatedRoute, private router: Router, private location: Location,
private componentFactoryResolver: ComponentFactoryResolver) {
}
async ngOnInit() {
@@ -164,6 +170,19 @@ export class VaultComponent implements OnInit {
this.go();
}
async openPasswordGenerator() {
let factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
let componentRef = this.passwordGeneratorModal.createComponent(factory);
let modal = componentRef.instance as ModalComponent;
let childComponent = modal.show<PasswordGeneratorComponent>(PasswordGeneratorComponent,
this.passwordGeneratorModal);
childComponent.in = 'hello';
childComponent.out.subscribe((i: string) => {
console.log(i);
//modal.close();
});
}
private clearFilters() {
this.folderId = null;
this.collectionId = null;