1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 16:53:34 +00:00

move groupings, ciphers, and search pipe to jslib

This commit is contained in:
Kyle Spearrin
2018-04-05 11:11:32 -04:00
parent 0adc40ec57
commit 0f2860c716
5 changed files with 14 additions and 187 deletions

View File

@@ -1,67 +1,17 @@
import * as template from './ciphers.component.html';
import {
Component,
EventEmitter,
Input,
Output,
} from '@angular/core';
import { Component } from '@angular/core';
import { CipherService } from 'jslib/abstractions/cipher.service';
import { CipherView } from 'jslib/models/view/cipherView';
import { CiphersComponent as BaseCiphersComponent } from 'jslib/angular/components/ciphers.component';
@Component({
selector: 'app-vault-ciphers',
template: template,
})
export class CiphersComponent {
@Input() activeCipherId: string = null;
@Output() onCipherClicked = new EventEmitter<CipherView>();
@Output() onCipherRightClicked = new EventEmitter<CipherView>();
@Output() onAddCipher = new EventEmitter();
@Output() onAddCipherOptions = new EventEmitter();
loaded: boolean = false;
ciphers: CipherView[] = [];
searchText: string;
searchPlaceholder: string = null;
private filter: (cipher: CipherView) => boolean = null;
constructor(private cipherService: CipherService) { }
async load(filter: (cipher: CipherView) => boolean = null) {
this.filter = filter;
const ciphers = await this.cipherService.getAllDecrypted();
if (this.filter == null) {
this.ciphers = ciphers;
} else {
this.ciphers = ciphers.filter(this.filter);
}
this.loaded = true;
}
async refresh() {
this.loaded = false;
this.ciphers = [];
await this.load(this.filter);
}
cipherClicked(cipher: CipherView) {
this.onCipherClicked.emit(cipher);
}
cipherRightClicked(cipher: CipherView) {
this.onCipherRightClicked.emit(cipher);
}
addCipher() {
this.onAddCipher.emit();
}
addCipherOptions() {
this.onAddCipherOptions.emit();
export class CiphersComponent extends BaseCiphersComponent {
constructor(cipherService: CipherService) {
super(cipherService);
}
}