mirror of
https://github.com/bitwarden/browser
synced 2025-12-13 06:43:35 +00:00
[PM-22614] replace disable cipher menu with hide (#15194)
* replace the disableMenu logic to be a hideMenu with ngIf * adding disable back for disabled rows during vault sync --------- Co-authored-by: kejaeger <138028972+kejaeger@users.noreply.github.com>
This commit is contained in:
@@ -93,73 +93,74 @@
|
|||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
</bit-menu>
|
</bit-menu>
|
||||||
<button
|
@if (!decryptionFailure && !hideMenu) {
|
||||||
*ngIf="!decryptionFailure"
|
|
||||||
[disabled]="disabled || disableMenu"
|
|
||||||
[bitMenuTriggerFor]="cipherOptions"
|
|
||||||
size="small"
|
|
||||||
bitIconButton="bwi-ellipsis-v"
|
|
||||||
type="button"
|
|
||||||
appA11yTitle="{{ (disableMenu ? 'missingPermissions' : 'options') | i18n }}"
|
|
||||||
appStopProp
|
|
||||||
></button>
|
|
||||||
<bit-menu #cipherOptions>
|
|
||||||
<ng-container *ngIf="isNotDeletedLoginCipher">
|
|
||||||
<button bitMenuItem type="button" (click)="copy('username')" *ngIf="hasUsernameToCopy">
|
|
||||||
<i class="bwi bwi-fw bwi-clone" aria-hidden="true"></i>
|
|
||||||
{{ "copyUsername" | i18n }}
|
|
||||||
</button>
|
|
||||||
<button bitMenuItem type="button" (click)="copy('password')" *ngIf="hasPasswordToCopy">
|
|
||||||
<i class="bwi bwi-fw bwi-clone" aria-hidden="true"></i>
|
|
||||||
{{ "copyPassword" | i18n }}
|
|
||||||
</button>
|
|
||||||
<button bitMenuItem type="button" (click)="copy('totp')" *ngIf="showTotpCopyButton">
|
|
||||||
<i class="bwi bwi-fw bwi-clone" aria-hidden="true"></i>
|
|
||||||
{{ "copyVerificationCode" | i18n }}
|
|
||||||
</button>
|
|
||||||
<a
|
|
||||||
bitMenuItem
|
|
||||||
*ngIf="canLaunch"
|
|
||||||
type="button"
|
|
||||||
[href]="launchUri"
|
|
||||||
target="_blank"
|
|
||||||
rel="noreferrer"
|
|
||||||
>
|
|
||||||
<i class="bwi bwi-fw bwi-external-link" aria-hidden="true"></i>
|
|
||||||
{{ "launch" | i18n }}
|
|
||||||
</a>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<button bitMenuItem *ngIf="showAttachments" type="button" (click)="attachments()">
|
|
||||||
<i class="bwi bwi-fw bwi-paperclip" aria-hidden="true"></i>
|
|
||||||
{{ "attachments" | i18n }}
|
|
||||||
</button>
|
|
||||||
<button bitMenuItem *ngIf="showClone" type="button" (click)="clone()">
|
|
||||||
<i class="bwi bwi-fw bwi-files" aria-hidden="true"></i>
|
|
||||||
{{ "clone" | i18n }}
|
|
||||||
</button>
|
|
||||||
<button
|
<button
|
||||||
bitMenuItem
|
[bitMenuTriggerFor]="cipherOptions"
|
||||||
*ngIf="showAssignToCollections"
|
[disabled]="disabled"
|
||||||
|
size="small"
|
||||||
|
bitIconButton="bwi-ellipsis-v"
|
||||||
type="button"
|
type="button"
|
||||||
(click)="assignToCollections()"
|
appStopProp
|
||||||
>
|
appA11yTitle="{{ 'options' | i18n }}"
|
||||||
<i class="bwi bwi-fw bwi-collection-shared" aria-hidden="true"></i>
|
></button>
|
||||||
{{ "assignToCollections" | i18n }}
|
<bit-menu #cipherOptions>
|
||||||
</button>
|
<ng-container *ngIf="isNotDeletedLoginCipher">
|
||||||
<button bitMenuItem *ngIf="showEventLogs" type="button" (click)="events()">
|
<button bitMenuItem type="button" (click)="copy('username')" *ngIf="hasUsernameToCopy">
|
||||||
<i class="bwi bwi-fw bwi-file-text" aria-hidden="true"></i>
|
<i class="bwi bwi-fw bwi-clone" aria-hidden="true"></i>
|
||||||
{{ "eventLogs" | i18n }}
|
{{ "copyUsername" | i18n }}
|
||||||
</button>
|
</button>
|
||||||
<button bitMenuItem (click)="restore()" type="button" *ngIf="isDeleted && canRestoreCipher">
|
<button bitMenuItem type="button" (click)="copy('password')" *ngIf="hasPasswordToCopy">
|
||||||
<i class="bwi bwi-fw bwi-undo" aria-hidden="true"></i>
|
<i class="bwi bwi-fw bwi-clone" aria-hidden="true"></i>
|
||||||
{{ "restore" | i18n }}
|
{{ "copyPassword" | i18n }}
|
||||||
</button>
|
</button>
|
||||||
<button bitMenuItem *ngIf="canDeleteCipher" (click)="deleteCipher()" type="button">
|
<button bitMenuItem type="button" (click)="copy('totp')" *ngIf="showTotpCopyButton">
|
||||||
<span class="tw-text-danger">
|
<i class="bwi bwi-fw bwi-clone" aria-hidden="true"></i>
|
||||||
<i class="bwi bwi-fw bwi-trash" aria-hidden="true"></i>
|
{{ "copyVerificationCode" | i18n }}
|
||||||
{{ (isDeleted ? "permanentlyDelete" : "delete") | i18n }}
|
</button>
|
||||||
</span>
|
<a
|
||||||
</button>
|
bitMenuItem
|
||||||
</bit-menu>
|
*ngIf="canLaunch"
|
||||||
|
type="button"
|
||||||
|
[href]="launchUri"
|
||||||
|
target="_blank"
|
||||||
|
rel="noreferrer"
|
||||||
|
>
|
||||||
|
<i class="bwi bwi-fw bwi-external-link" aria-hidden="true"></i>
|
||||||
|
{{ "launch" | i18n }}
|
||||||
|
</a>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<button bitMenuItem *ngIf="showAttachments" type="button" (click)="attachments()">
|
||||||
|
<i class="bwi bwi-fw bwi-paperclip" aria-hidden="true"></i>
|
||||||
|
{{ "attachments" | i18n }}
|
||||||
|
</button>
|
||||||
|
<button bitMenuItem *ngIf="showClone" type="button" (click)="clone()">
|
||||||
|
<i class="bwi bwi-fw bwi-files" aria-hidden="true"></i>
|
||||||
|
{{ "clone" | i18n }}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
bitMenuItem
|
||||||
|
*ngIf="showAssignToCollections"
|
||||||
|
type="button"
|
||||||
|
(click)="assignToCollections()"
|
||||||
|
>
|
||||||
|
<i class="bwi bwi-fw bwi-collection-shared" aria-hidden="true"></i>
|
||||||
|
{{ "assignToCollections" | i18n }}
|
||||||
|
</button>
|
||||||
|
<button bitMenuItem *ngIf="showEventLogs" type="button" (click)="events()">
|
||||||
|
<i class="bwi bwi-fw bwi-file-text" aria-hidden="true"></i>
|
||||||
|
{{ "eventLogs" | i18n }}
|
||||||
|
</button>
|
||||||
|
<button bitMenuItem (click)="restore()" type="button" *ngIf="isDeleted && canRestoreCipher">
|
||||||
|
<i class="bwi bwi-fw bwi-undo" aria-hidden="true"></i>
|
||||||
|
{{ "restore" | i18n }}
|
||||||
|
</button>
|
||||||
|
<button bitMenuItem *ngIf="canDeleteCipher" (click)="deleteCipher()" type="button">
|
||||||
|
<span class="tw-text-danger">
|
||||||
|
<i class="bwi bwi-fw bwi-trash" aria-hidden="true"></i>
|
||||||
|
{{ (isDeleted ? "permanentlyDelete" : "delete") | i18n }}
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</bit-menu>
|
||||||
|
}
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -189,8 +189,14 @@ export class VaultCipherRowComponent<C extends CipherViewLike> implements OnInit
|
|||||||
return this.i18nService.t("noAccess");
|
return this.i18nService.t("noAccess");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected get showCopyUsername(): boolean {
|
||||||
|
const usernameCopy = CipherViewLikeUtils.hasCopyableValue(this.cipher, "username");
|
||||||
|
return this.isNotDeletedLoginCipher && usernameCopy;
|
||||||
|
}
|
||||||
|
|
||||||
protected get showCopyPassword(): boolean {
|
protected get showCopyPassword(): boolean {
|
||||||
return this.isNotDeletedLoginCipher && this.cipher.viewPassword;
|
const passwordCopy = CipherViewLikeUtils.hasCopyableValue(this.cipher, "password");
|
||||||
|
return this.isNotDeletedLoginCipher && this.cipher.viewPassword && passwordCopy;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected get showCopyTotp(): boolean {
|
protected get showCopyTotp(): boolean {
|
||||||
@@ -201,16 +207,20 @@ export class VaultCipherRowComponent<C extends CipherViewLike> implements OnInit
|
|||||||
return this.isNotDeletedLoginCipher && this.canLaunch;
|
return this.isNotDeletedLoginCipher && this.canLaunch;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected get disableMenu() {
|
protected get isDeletedCanRestore(): boolean {
|
||||||
|
return CipherViewLikeUtils.isDeleted(this.cipher) && this.canRestoreCipher;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected get hideMenu() {
|
||||||
return !(
|
return !(
|
||||||
this.isNotDeletedLoginCipher ||
|
this.isDeletedCanRestore ||
|
||||||
|
this.showCopyUsername ||
|
||||||
this.showCopyPassword ||
|
this.showCopyPassword ||
|
||||||
this.showCopyTotp ||
|
this.showCopyTotp ||
|
||||||
this.showLaunchUri ||
|
this.showLaunchUri ||
|
||||||
this.showAttachments ||
|
this.showAttachments ||
|
||||||
this.showClone ||
|
this.showClone ||
|
||||||
this.canEditCipher ||
|
this.canEditCipher
|
||||||
(CipherViewLikeUtils.isDeleted(this.cipher) && this.canRestoreCipher)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user