This is an automated email from the ASF dual-hosted git repository. github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-7995-ddb51b4428e43d9fe57ebf99a655e62b3130f080 in repository https://gitbox.apache.org/repos/asf/texera.git
commit 2e261e47dea226aaec304fb6edbd815d14cec93a Author: anthonychengit <[email protected]> AuthorDate: Thu Sep 24 03:45:51 2026 +0000 fix(frontend): disable repeat remove buttons (#7995) ### What changes were proposed in this PR? Rename the repeat row's <code>*ngFor</code> variable so it no longer shadows the component's <code>field</code>. The remove buttons now read the section-level <code>templateOptions.disabled</code>, matching the add button. | Before | After | | --- | --- | | Remove buttons stay active while the section is disabled. | All remove buttons and the add button are disabled together. | |  |  | Permanent rendering tests cover both directions: every remove button is disabled for a disabled section, and every remove button remains available otherwise. ### Any related issues, documentation, discussions? Closes #7431 ### How was this PR tested? ~~~powershell cd frontend node node_modules\@angular\cli\bin\ng.js test --watch=false --include src/app/common/formly/repeat-dnd/repeat-dnd.component.spec.ts node .yarn\releases\yarn-4.14.1.cjs run format:ci git diff --check ~~~ Result: 14 tests passed; the frontend Prettier and ESLint CI check passed; <code>git diff --check</code> passed. The before/after evidence above was captured from the actual Angular component in Playwright Chromium with <code>templateOptions.disabled = true</code>. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: OpenAI Codex (GPT-5) Co-authored-by: Xuan Gu <[email protected]> --- .../app/common/formly/repeat-dnd/repeat-dnd.component.html | 4 ++-- .../common/formly/repeat-dnd/repeat-dnd.component.spec.ts | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/common/formly/repeat-dnd/repeat-dnd.component.html b/frontend/src/app/common/formly/repeat-dnd/repeat-dnd.component.html index 13ef4386ac..7f53df1c67 100644 --- a/frontend/src/app/common/formly/repeat-dnd/repeat-dnd.component.html +++ b/frontend/src/app/common/formly/repeat-dnd/repeat-dnd.component.html @@ -21,7 +21,7 @@ cdkDropList (cdkDropListDropped)="onDrop($event)"> <div - *ngFor="let field of field.fieldGroup; let i = index" + *ngFor="let row of field.fieldGroup; let i = index" cdkDrag class="dnd-row"> <div @@ -35,7 +35,7 @@ <div class="dnd-field-wrapper"> <formly-field - *ngFor="let subField of field.fieldGroup" + *ngFor="let subField of row.fieldGroup" class="dnd-field" [field]="subField"></formly-field> </div> diff --git a/frontend/src/app/common/formly/repeat-dnd/repeat-dnd.component.spec.ts b/frontend/src/app/common/formly/repeat-dnd/repeat-dnd.component.spec.ts index 6a088a3dc5..cb37171b92 100644 --- a/frontend/src/app/common/formly/repeat-dnd/repeat-dnd.component.spec.ts +++ b/frontend/src/app/common/formly/repeat-dnd/repeat-dnd.component.spec.ts @@ -185,6 +185,20 @@ describe("FormlyRepeatDndComponent", () => { expect(spy).toHaveBeenCalledWith(1); }); + it("locks every remove button for a disabled section", () => { + render({ disabled: true }); + + expect(removeButtons()).toHaveLength(3); + expect(removeButtons().every(button => button.getAttribute("disabled") !== null)).toBe(true); + }); + + it("leaves every remove button available otherwise", () => { + render({ disabled: false }); + + expect(removeButtons()).toHaveLength(3); + expect(removeButtons().every(button => button.getAttribute("disabled") === null)).toBe(true); + }); + it("appends a row from the add button", () => { const spy = vi.spyOn(component, "add").mockImplementation(() => {}); render();
