1
0
mirror of https://github.com/bitwarden/web synced 2026-01-19 08:54:06 +00:00

org component, org vault listing updates

This commit is contained in:
Kyle Spearrin
2018-07-04 09:55:52 -04:00
parent db43f817f7
commit 32f62b7ceb
16 changed files with 172 additions and 62 deletions

View File

@@ -1,6 +1,7 @@
import {
Component,
EventEmitter,
Input,
Output,
} from '@angular/core';
@@ -26,6 +27,7 @@ import { CipherView } from 'jslib/models/view/cipherView';
templateUrl: '../vault/ciphers.component.html',
})
export class CiphersComponent extends BaseCiphersComponent {
@Input() showAddNew = true;
@Output() onAttachmentsClicked = new EventEmitter<CipherView>();
@Output() onCollectionsClicked = new EventEmitter<CipherView>();
@@ -58,7 +60,16 @@ export class CiphersComponent extends BaseCiphersComponent {
this.applyFilter(filter);
this.loaded = true;
} else {
await super.load((c) => c.organizationId === this.organization.id && (filter == null || filter(c)));
await super.load();
}
}
applyFilter(filter: (cipher: CipherView) => boolean = null) {
if (this.organization.isAdmin) {
super.applyFilter(filter);
} else {
const f = (c: CipherView) => c.organizationId === this.organization.id && (filter == null || filter(c));
super.applyFilter(f);
}
}

View File

@@ -54,15 +54,15 @@ export class GroupingsComponent extends BaseGroupingsComponent {
} else {
this.collections = [];
}
const unassignedCollection = new CollectionView();
unassignedCollection.name = this.i18nService.t('unassigned');
unassignedCollection.id = 'unassigned';
unassignedCollection.organizationId = this.organization.id;
unassignedCollection.readOnly = true;
this.collections.push(unassignedCollection);
} else {
await super.loadCollections(this.organization.id);
}
const unassignedCollection = new CollectionView();
unassignedCollection.name = this.i18nService.t('unassigned');
unassignedCollection.id = 'unassigned';
unassignedCollection.organizationId = this.organization.id;
unassignedCollection.readOnly = true;
this.collections.push(unassignedCollection);
}
}

View File

@@ -71,6 +71,7 @@ export class VaultComponent implements OnInit {
}
async clearGroupingFilters() {
this.ciphersComponent.showAddNew = true;
this.groupingsComponent.searchPlaceholder = this.i18nService.t('searchVault');
await this.ciphersComponent.applyFilter();
this.clearFilters();
@@ -78,6 +79,7 @@ export class VaultComponent implements OnInit {
}
async filterCipherType(type: CipherType, load = false) {
this.ciphersComponent.showAddNew = true;
this.groupingsComponent.searchPlaceholder = this.i18nService.t('searchType');
const filter = (c: CipherView) => c.type === type;
if (load) {
@@ -91,6 +93,7 @@ export class VaultComponent implements OnInit {
}
async filterCollection(collectionId: string, load = false) {
this.ciphersComponent.showAddNew = false;
this.groupingsComponent.searchPlaceholder = this.i18nService.t('searchCollection');
const filter = (c: CipherView) => {
if (collectionId === 'unassigned') {