1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 07:43:35 +00:00
Files
browser/apps/web/src/app/vault/components/vault-items/vault-cipher-row.component.ts
Jason Ng 2347b96dba AC-2057 3dot menu missing in individual vault (#7529)
* update individual vault so 3dot menu shows in cipher row
2024-01-12 15:00:11 -05:00

99 lines
2.8 KiB
TypeScript

import { Component, EventEmitter, HostBinding, HostListener, Input, Output } from "@angular/core";
import { ActivatedRoute, Router } from "@angular/router";
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
import { CipherType } from "@bitwarden/common/vault/enums";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import { CollectionView } from "@bitwarden/common/vault/models/view/collection.view";
import { VaultItemEvent } from "./vault-item-event";
import { RowHeightClass } from "./vault-items.component";
@Component({
selector: "tr[appVaultCipherRow]",
templateUrl: "vault-cipher-row.component.html",
})
export class VaultCipherRowComponent {
protected RowHeightClass = RowHeightClass;
@Input() disabled: boolean;
@Input() cipher: CipherView;
@Input() showOwner: boolean;
@Input() showCollections: boolean;
@Input() showGroups: boolean;
@Input() showPremiumFeatures: boolean;
@Input() useEvents: boolean;
@Input() cloneable: boolean;
@Input() organizations: Organization[];
@Input() collections: CollectionView[];
@Input() viewingOrgVault: boolean;
@Output() onEvent = new EventEmitter<VaultItemEvent>();
@Input() checked: boolean;
@Output() checkedToggled = new EventEmitter<void>();
protected CipherType = CipherType;
constructor(
private router: Router,
private activatedRoute: ActivatedRoute,
) {}
@HostBinding("class")
get classes() {
return [].concat(this.disabled ? [] : ["tw-cursor-pointer"]);
}
protected get showTotpCopyButton() {
return (
(this.cipher.login?.hasTotp ?? false) &&
(this.cipher.organizationUseTotp || this.showPremiumFeatures)
);
}
protected get showFixOldAttachments() {
return this.cipher.hasOldAttachments && this.cipher.organizationId == null;
}
@HostListener("click")
protected click() {
this.router.navigate([], {
queryParams: { itemId: this.cipher.id },
queryParamsHandling: "merge",
});
}
protected copy(field: "username" | "password" | "totp") {
this.onEvent.emit({ type: "copyField", item: this.cipher, field });
}
protected clone() {
this.onEvent.emit({ type: "clone", item: this.cipher });
}
protected moveToOrganization() {
this.onEvent.emit({ type: "moveToOrganization", items: [this.cipher] });
}
protected editCollections() {
this.onEvent.emit({ type: "viewCollections", item: this.cipher });
}
protected events() {
this.onEvent.emit({ type: "viewEvents", item: this.cipher });
}
protected restore() {
this.onEvent.emit({ type: "restore", items: [this.cipher] });
}
protected deleteCipher() {
this.onEvent.emit({ type: "delete", items: [{ cipher: this.cipher }] });
}
protected attachments() {
this.onEvent.emit({ type: "viewAttachments", item: this.cipher });
}
}