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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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') {
|
||||
|
||||
Reference in New Issue
Block a user