mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 15:53:27 +00:00
* [deps] Autofill: Update prettier to v3 * prettier formatting updates --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jonathan Prusik <jprusik@classynemesis.com>
98 lines
2.8 KiB
TypeScript
98 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[];
|
|
|
|
@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 });
|
|
}
|
|
}
|