diff --git a/libs/vault/src/cipher-form/components/additional-options/additional-options-section.component.ts b/libs/vault/src/cipher-form/components/additional-options/additional-options-section.component.ts index 63b721a72fc..3a7152bfe24 100644 --- a/libs/vault/src/cipher-form/components/additional-options/additional-options-section.component.ts +++ b/libs/vault/src/cipher-form/components/additional-options/additional-options-section.component.ts @@ -1,15 +1,7 @@ // FIXME: Update this file to be type safe and remove this and next line // @ts-strict-ignore import { CommonModule } from "@angular/common"; -import { - ChangeDetectorRef, - Component, - DestroyRef, - inject, - Input, - OnInit, - ViewChild, -} from "@angular/core"; +import { ChangeDetectorRef, Component, Input, OnInit, ViewChild } from "@angular/core"; import { takeUntilDestroyed } from "@angular/core/rxjs-interop"; import { FormBuilder, ReactiveFormsModule } from "@angular/forms"; import { shareReplay } from "rxjs"; @@ -64,12 +56,12 @@ export class AdditionalOptionsSectionComponent implements OnInit { /** True when the form is in `partial-edit` mode */ isPartialEdit = false; - /** True when the form allows new fields to be added */ - allowNewField = true; - @Input() disableSectionMargin: boolean; - private destroyRef = inject(DestroyRef); + /** True when the form allows new fields to be added */ + get allowNewField(): boolean { + return this.additionalOptionsForm.enabled; + } constructor( private cipherFormContainer: CipherFormContainer, @@ -102,17 +94,6 @@ export class AdditionalOptionsSectionComponent implements OnInit { this.additionalOptionsForm.disable(); this.isPartialEdit = true; } - - // Disable adding new URIs when the cipher form is disabled - this.cipherFormContainer.formStatusChange$ - .pipe(takeUntilDestroyed(this.destroyRef)) - .subscribe((status) => { - if (status === "disabled") { - this.allowNewField = false; - } else if (status === "enabled") { - this.allowNewField = true; - } - }); } /** Opens the add custom field dialog */