1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-06-25 10:25:36 +02:00

[EC-1026] Use primary action when clicking on vault row (#4541)

This commit is contained in:
Jake Fink 2023-01-25 11:01:46 -05:00 committed by GitHub
parent d78be8eaf3
commit e3f1150fcb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 34 additions and 32 deletions

View File

@ -163,10 +163,6 @@ export class VaultItemsComponent extends BaseVaultItemsComponent implements OnDe
} }
} }
selectRow(item: VaultItemRow) {
this.checkRow(item);
}
checkRow(item: VaultItemRow, select?: boolean) { checkRow(item: VaultItemRow, select?: boolean) {
if (item instanceof TreeNode && item.node.id == null) { if (item instanceof TreeNode && item.node.id == null) {
return; return;

View File

@ -86,7 +86,7 @@
[activeFilter]="activeFilter" [activeFilter]="activeFilter"
[initOrganization]="organization" [initOrganization]="organization"
(activeFilterChanged)="applyVaultFilter($event)" (activeFilterChanged)="applyVaultFilter($event)"
(onCipherClicked)="editCipher($event)" (onCipherClicked)="navigateToCipher($event)"
(onAttachmentsClicked)="editCipherAttachments($event)" (onAttachmentsClicked)="editCipherAttachments($event)"
(onAddCipher)="addCipher()" (onAddCipher)="addCipher()"
(onEditCipherCollectionsClicked)="editCipherCollections($event)" (onEditCipherCollectionsClicked)="editCipherCollections($event)"

View File

@ -294,6 +294,10 @@ export class VaultComponent implements OnInit, OnDestroy {
} }
} }
async navigateToCipher(cipher: CipherView) {
this.go({ itemId: cipher?.id });
}
async editCipher(cipher: CipherView) { async editCipher(cipher: CipherView) {
return this.editCipherId(cipher?.id); return this.editCipherId(cipher?.id);
} }

View File

@ -71,8 +71,14 @@
</tr> </tr>
</ng-container> </ng-container>
<ng-template body> <ng-template body>
<tr bitRow *ngFor="let col of filteredCollections" alignContent="middle"> <tr
<td bitCell (click)="selectRow(col)"> bitRow
*ngFor="let col of filteredCollections"
(click)="navigateCollection(col)"
class="tw-cursor-pointer"
alignContent="middle"
>
<td bitCell (click)="checkRow(col)" appStopProp>
<input <input
*ngIf="canDeleteCollection(col.node)" *ngIf="canDeleteCollection(col.node)"
class="tw-cursor-pointer" class="tw-cursor-pointer"
@ -81,12 +87,12 @@
appStopProp appStopProp
/> />
</td> </td>
<td bitCell (click)="selectRow(col)"> <td bitCell>
<div class="icon" aria-hidden="true"> <div class="icon" aria-hidden="true">
<i class="bwi bwi-fw bwi-lg bwi-collection"></i> <i class="bwi bwi-fw bwi-lg bwi-collection"></i>
</div> </div>
</td> </td>
<td bitCell (click)="selectRow(col)"> <td bitCell>
<button <button
bitLink bitLink
class="tw-text-start" class="tw-text-start"
@ -96,7 +102,7 @@
{{ col.node.name }} {{ col.node.name }}
</button> </button>
</td> </td>
<td bitCell (click)="selectRow(col)"> <td bitCell>
<ng-container *ngIf="!organization"> <ng-container *ngIf="!organization">
<app-org-badge <app-org-badge
organizationName="{{ col.node.organizationId | orgNameFromId: organizations }}" organizationName="{{ col.node.organizationId | orgNameFromId: organizations }}"
@ -114,7 +120,7 @@
></app-group-badge> ></app-group-badge>
</ng-container> </ng-container>
</td> </td>
<td bitCell class="tw-text-right" (click)="selectRow(col)"> <td bitCell class="tw-text-right">
<button <button
*ngIf="canEditCollection(col.node) || canDeleteCollection(col.node)" *ngIf="canEditCollection(col.node) || canDeleteCollection(col.node)"
[bitMenuTriggerFor]="collectionOptions" [bitMenuTriggerFor]="collectionOptions"
@ -154,14 +160,20 @@
</bit-menu> </bit-menu>
</td> </td>
</tr> </tr>
<tr bitRow *ngFor="let c of filteredCiphers" alignContent="middle"> <tr
<td bitCell (click)="selectRow(c)"> bitRow
*ngFor="let c of filteredCiphers"
class="tw-cursor-pointer"
(click)="selectCipher(c)"
alignContent="middle"
>
<td bitCell (click)="checkRow(c)" appStopProp>
<input type="checkbox" [(ngModel)]="$any(c).checked" appStopProp /> <input type="checkbox" [(ngModel)]="$any(c).checked" appStopProp />
</td> </td>
<td bitCell (click)="selectRow(c)"> <td bitCell>
<app-vault-icon [cipher]="c"></app-vault-icon> <app-vault-icon [cipher]="c"></app-vault-icon>
</td> </td>
<td bitCell class="tw-break-all" (click)="selectRow(c)"> <td bitCell class="tw-break-all">
<button <button
bitLink bitLink
class="tw-text-start" class="tw-text-start"
@ -193,7 +205,7 @@
<br /> <br />
<span class="tw-text-sm tw-text-muted" appStopProp>{{ c.subTitle }}</span> <span class="tw-text-sm tw-text-muted" appStopProp>{{ c.subTitle }}</span>
</td> </td>
<td bitCell (click)="selectRow(c)"> <td bitCell>
<ng-container *ngIf="!organization"> <ng-container *ngIf="!organization">
<app-org-badge <app-org-badge
organizationName="{{ c.organizationId | orgNameFromId: organizations }}" organizationName="{{ c.organizationId | orgNameFromId: organizations }}"
@ -211,7 +223,7 @@
></app-collection-badge> ></app-collection-badge>
</ng-container> </ng-container>
</td> </td>
<td bitCell class="tw-text-right" (click)="selectRow(c)"> <td bitCell class="tw-text-right">
<button <button
[bitMenuTriggerFor]="cipherOptions" [bitMenuTriggerFor]="cipherOptions"
size="small" size="small"

View File

@ -453,14 +453,6 @@ export class VaultItemsComponent extends BaseVaultItemsComponent implements OnDe
} }
} }
selectRow(item: VaultItemRow) {
if (item instanceof CipherView) {
this.checkRow(item);
} else if (item instanceof TreeNode) {
this.navigateCollection(item);
}
}
navigateCollection(node: TreeNode<CollectionFilter>) { navigateCollection(node: TreeNode<CollectionFilter>) {
const filter = this.activeFilter; const filter = this.activeFilter;
filter.selectedCollectionNode = node; filter.selectedCollectionNode = node;
@ -507,12 +499,6 @@ export class VaultItemsComponent extends BaseVaultItemsComponent implements OnDe
); );
} }
async selectCipher(cipher: CipherView) {
if (await this.repromptCipher(cipher)) {
super.selectCipher(cipher);
}
}
onOrganizationClicked(organizationId: string) { onOrganizationClicked(organizationId: string) {
this.onOrganzationBadgeClicked.emit(organizationId); this.onOrganzationBadgeClicked.emit(organizationId);
} }

View File

@ -60,7 +60,7 @@
<app-vault-items <app-vault-items
[activeFilter]="activeFilter" [activeFilter]="activeFilter"
(activeFilterChanged)="applyVaultFilter($event)" (activeFilterChanged)="applyVaultFilter($event)"
(onCipherClicked)="editCipher($event)" (onCipherClicked)="navigateToCipher($event)"
(onAttachmentsClicked)="editCipherAttachments($event)" (onAttachmentsClicked)="editCipherAttachments($event)"
(onAddCipher)="addCipher()" (onAddCipher)="addCipher()"
(onShareClicked)="shareCipher($event)" (onShareClicked)="shareCipher($event)"

View File

@ -332,6 +332,10 @@ export class VaultComponent implements OnInit, OnDestroy {
component.folderId = this.activeFilter.folderId; component.folderId = this.activeFilter.folderId;
} }
async navigateToCipher(cipher: CipherView) {
this.go({ itemId: cipher?.id });
}
async editCipher(cipher: CipherView) { async editCipher(cipher: CipherView) {
return this.editCipherId(cipher?.id); return this.editCipherId(cipher?.id);
} }