2018-01-24 23:41:57 +01:00
|
|
|
import * as template from './add.component.html';
|
|
|
|
|
|
|
|
import {
|
|
|
|
Component,
|
|
|
|
Input,
|
|
|
|
OnChanges,
|
|
|
|
} from '@angular/core';
|
|
|
|
|
2018-01-25 20:57:49 +01:00
|
|
|
import { CipherType } from 'jslib/enums/cipherType';
|
|
|
|
import { SecureNoteType } from 'jslib/enums/secureNoteType';
|
|
|
|
|
2018-01-24 23:41:57 +01:00
|
|
|
import { CipherService } from 'jslib/abstractions/cipher.service';
|
|
|
|
|
2018-01-25 20:57:49 +01:00
|
|
|
import { CardView } from 'jslib/models/view/cardView';
|
2018-01-24 23:41:57 +01:00
|
|
|
import { CipherView } from 'jslib/models/view/cipherView';
|
2018-01-25 20:57:49 +01:00
|
|
|
import { IdentityView } from 'jslib/models/view/identityView';
|
|
|
|
import { LoginView } from 'jslib/models/view/loginView';
|
|
|
|
import { SecureNoteView } from 'jslib/models/view/secureNoteView';
|
2018-01-24 23:41:57 +01:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-vault-add',
|
|
|
|
template: template,
|
|
|
|
})
|
|
|
|
export class AddComponent implements OnChanges {
|
|
|
|
@Input() folderId: string;
|
|
|
|
cipher: CipherView;
|
|
|
|
|
|
|
|
constructor(private cipherService: CipherService) {
|
|
|
|
}
|
|
|
|
|
|
|
|
async ngOnChanges() {
|
|
|
|
this.cipher = new CipherView();
|
2018-01-25 20:57:49 +01:00
|
|
|
this.cipher.folderId = null; // TODO
|
|
|
|
this.cipher.type = CipherType.Login;
|
|
|
|
this.cipher.login = new LoginView();
|
|
|
|
this.cipher.card = new CardView();
|
|
|
|
this.cipher.identity = new IdentityView();
|
|
|
|
this.cipher.secureNote = new SecureNoteView();
|
|
|
|
this.cipher.secureNote.type = SecureNoteType.Generic;
|
2018-01-24 23:41:57 +01:00
|
|
|
}
|
|
|
|
}
|