From 44a6393e2594db62892c807a55ba130d88868b1d Mon Sep 17 00:00:00 2001 From: jaasen-livefront Date: Mon, 11 Aug 2025 16:04:06 -0700 Subject: [PATCH] disable all remaining form fields for editing personally owned My Items --- .../vault-item-dialog.component.html | 8 +++++- .../vault-item-dialog.component.ts | 6 +++++ .../src/cipher-form/cipher-form-container.ts | 6 ++--- .../additional-options-section.component.html | 2 +- .../additional-options-section.component.ts | 26 ++++++++++++++++++- .../autofill-options.component.ts | 14 ++++++++-- .../components/cipher-form.component.ts | 11 +++++--- .../item-details-section.component.html | 1 + .../item-details-section.component.ts | 4 +++ .../sshkey-section.component.ts | 8 ++++-- 10 files changed, 73 insertions(+), 13 deletions(-) diff --git a/apps/web/src/app/vault/components/vault-item-dialog/vault-item-dialog.component.html b/apps/web/src/app/vault/components/vault-item-dialog/vault-item-dialog.component.html index 45df670570d..1bf26ede0e4 100644 --- a/apps/web/src/app/vault/components/vault-item-dialog/vault-item-dialog.component.html +++ b/apps/web/src/app/vault/components/vault-item-dialog/vault-item-dialog.component.html @@ -16,9 +16,15 @@ [submitBtn]="submitBtn" (formReady)="onFormReady()" (cipherSaved)="onCipherSaved($event)" + (onFormStatusChange)="formStatusChanged($event)" > - diff --git a/libs/vault/src/cipher-form/components/item-details/item-details-section.component.ts b/libs/vault/src/cipher-form/components/item-details/item-details-section.component.ts index 4fd999ae601..8875676e88d 100644 --- a/libs/vault/src/cipher-form/components/item-details/item-details-section.component.ts +++ b/libs/vault/src/cipher-form/components/item-details/item-details-section.component.ts @@ -82,6 +82,8 @@ export class ItemDetailsSectionComponent implements OnInit { protected userId: UserId; + protected isFavoriteButtonDisabled = false; + @Input({ required: true }) config: CipherFormConfig; @@ -248,8 +250,10 @@ export class ItemDetailsSectionComponent implements OnInit { if (this.itemDetailsForm.controls.organizationId.value === null) { this.cipherFormContainer.disableFormFields(); this.itemDetailsForm.controls.organizationId.enable(); + this.isFavoriteButtonDisabled = true; } else { this.cipherFormContainer.enableFormFields(); + this.isFavoriteButtonDisabled = false; } } } diff --git a/libs/vault/src/cipher-form/components/sshkey-section/sshkey-section.component.ts b/libs/vault/src/cipher-form/components/sshkey-section/sshkey-section.component.ts index f83f93267c9..f92c4420d03 100644 --- a/libs/vault/src/cipher-form/components/sshkey-section/sshkey-section.component.ts +++ b/libs/vault/src/cipher-form/components/sshkey-section/sshkey-section.component.ts @@ -98,9 +98,13 @@ export class SshKeySectionComponent implements OnInit { // Disable the form if the cipher form container is enabled // to prevent user interaction - this.cipherFormContainer.formEnabled$ + this.cipherFormContainer.formStatusChange$ .pipe(takeUntilDestroyed(this.destroyRef)) - .subscribe(() => this.sshKeyForm.disable()); + .subscribe((status) => { + if (status === "enabled") { + this.sshKeyForm.disable(); + } + }); } /** Set form initial form values from the current cipher */