mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-27 12:36:14 +01:00
pre-select org an collection on add
This commit is contained in:
parent
bc5cec82cc
commit
6627d29c7c
2
jslib
2
jslib
@ -1 +1 @@
|
|||||||
Subproject commit aa0b274f8fd80db620abd4a85c3086f511e19c88
|
Subproject commit a98a8bda9bea5b7bb4459cea9413e0f03b2aa068
|
@ -43,6 +43,13 @@ export class AddEditComponent extends BaseAddEditComponent {
|
|||||||
if (params.folderId) {
|
if (params.folderId) {
|
||||||
this.folderId = params.folderId;
|
this.folderId = params.folderId;
|
||||||
}
|
}
|
||||||
|
if (params.collectionId) {
|
||||||
|
const collection = this.writeableCollections.filter((c) => c.id === params.collectionId);
|
||||||
|
if (collection != null && collection.length > 0) {
|
||||||
|
this.collectionIds = [collection[0].id];
|
||||||
|
this.organizationId = collection[0].organizationId;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (params.type) {
|
if (params.type) {
|
||||||
const type = parseInt(params.type, null);
|
const type = parseInt(params.type, null);
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
[(ngModel)]="searchText" (input)="search(200)" appAutofocus>
|
[(ngModel)]="searchText" (input)="search(200)" appAutofocus>
|
||||||
<i class="fa fa-search"></i>
|
<i class="fa fa-search"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="right" *ngIf="showAdd">
|
<div class="right">
|
||||||
<button type="button" appBlurClick (click)="addCipher()" title="{{'addItem' | i18n}}">
|
<button type="button" appBlurClick (click)="addCipher()" title="{{'addItem' | i18n}}">
|
||||||
<i class="fa fa-plus fa-lg fa-fw"></i>
|
<i class="fa fa-plus fa-lg fa-fw"></i>
|
||||||
</button>
|
</button>
|
||||||
@ -57,7 +57,7 @@
|
|||||||
<i class="fa fa-spinner fa-spin fa-3x" *ngIf="!loaded"></i>
|
<i class="fa fa-spinner fa-spin fa-3x" *ngIf="!loaded"></i>
|
||||||
<ng-container *ngIf="loaded">
|
<ng-container *ngIf="loaded">
|
||||||
<p>{{'noItemsInList' | i18n}}</p>
|
<p>{{'noItemsInList' | i18n}}</p>
|
||||||
<button (click)="addCipher()" class="btn block primary link" *ngIf="showAdd">
|
<button (click)="addCipher()" class="btn block primary link">
|
||||||
{{'addItem' | i18n}}
|
{{'addItem' | i18n}}
|
||||||
</button>
|
</button>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
@ -45,8 +45,8 @@ const ComponentId = 'CiphersComponent';
|
|||||||
export class CiphersComponent extends BaseCiphersComponent implements OnInit, OnDestroy {
|
export class CiphersComponent extends BaseCiphersComponent implements OnInit, OnDestroy {
|
||||||
groupingTitle: string;
|
groupingTitle: string;
|
||||||
state: any;
|
state: any;
|
||||||
showAdd = true;
|
|
||||||
folderId: string = null;
|
folderId: string = null;
|
||||||
|
collectionId: string = null;
|
||||||
type: CipherType = null;
|
type: CipherType = null;
|
||||||
pagedCiphers: CipherView[] = [];
|
pagedCiphers: CipherView[] = [];
|
||||||
nestedFolders: Array<TreeNode<FolderView>>;
|
nestedFolders: Array<TreeNode<FolderView>>;
|
||||||
@ -108,15 +108,15 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
|
|||||||
}
|
}
|
||||||
await super.load((c) => c.folderId === this.folderId);
|
await super.load((c) => c.folderId === this.folderId);
|
||||||
} else if (params.collectionId) {
|
} else if (params.collectionId) {
|
||||||
this.showAdd = false;
|
this.collectionId = params.collectionId;
|
||||||
this.searchPlaceholder = this.i18nService.t('searchCollection');
|
this.searchPlaceholder = this.i18nService.t('searchCollection');
|
||||||
const collectionNode = await this.collectionService.getNested(params.collectionId);
|
const collectionNode = await this.collectionService.getNested(this.collectionId);
|
||||||
if (collectionNode != null && collectionNode.node != null) {
|
if (collectionNode != null && collectionNode.node != null) {
|
||||||
this.groupingTitle = collectionNode.node.name;
|
this.groupingTitle = collectionNode.node.name;
|
||||||
this.nestedCollections = collectionNode.children != null && collectionNode.children.length > 0 ?
|
this.nestedCollections = collectionNode.children != null && collectionNode.children.length > 0 ?
|
||||||
collectionNode.children : null;
|
collectionNode.children : null;
|
||||||
}
|
}
|
||||||
await super.load((c) => c.collectionIds != null && c.collectionIds.indexOf(params.collectionId) > -1);
|
await super.load((c) => c.collectionIds != null && c.collectionIds.indexOf(this.collectionId) > -1);
|
||||||
} else {
|
} else {
|
||||||
this.groupingTitle = this.i18nService.t('allItems');
|
this.groupingTitle = this.i18nService.t('allItems');
|
||||||
await super.load();
|
await super.load();
|
||||||
@ -195,7 +195,13 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
|
|||||||
|
|
||||||
addCipher() {
|
addCipher() {
|
||||||
super.addCipher();
|
super.addCipher();
|
||||||
this.router.navigate(['/add-cipher'], { queryParams: { folderId: this.folderId, type: this.type } });
|
this.router.navigate(['/add-cipher'], {
|
||||||
|
queryParams: {
|
||||||
|
folderId: this.folderId,
|
||||||
|
type: this.type,
|
||||||
|
collectionId: this.collectionId,
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
back() {
|
back() {
|
||||||
|
Loading…
Reference in New Issue
Block a user