The GitHub Actions job "Required Checks" on texera.git/main has failed.
Run started by GitHub user github-merge-queue[bot] (triggered by 
github-merge-queue[bot]).

Head commit for run:
93438d13fb8c34052ce3552380f65043e1a24a38 / Eugene Gu <[email protected]>
fix(frontend): block clicks on disabled context menu items (#8968)

### What changes were proposed in this PR?

**Root cause.** Two items in the operator context menu grey themselves
out with `nzDisabled` but keep a `(click)` binding on the same `<li
nz-menu-item>`. In ng-zorro-antd 21.3.2, `nzDisabled` only adds the
disabled class and makes the component's own host click listener call
`preventDefault()` and `stopPropagation()`; the template `(click)` is a
sibling listener on the same element and still runs (`pointer-events:
none` is applied only to a nested `<a>`, which these items do not have).

- "execute to this operator": `[nzDisabled]="!canExecuteOperator()"`
with `(click)="operatorMenuService.executeUpToOperator()"`. Clicked
while greyed out mid-run, it sends a new execution request; the backend
shuts down the in-flight execution and clears its results, and that
execution's row stays RUNNING.
- "reuse result": hardcoded `[nzDisabled]="true"` with a `(click)` that
still ran.

```
Before:  greyed "execute to this operator" clicked mid-run -> new execution; 
the running one is shut down, its row left RUNNING
After:   greyed "execute to this operator" clicked -> onExecuteUpToOperator() 
returns early; nothing is sent
```

| Before: greyed item during a run (clicking it started eid 10 and shut
down eid 9) | After: greyed item clicked, same run continues |
| --- | --- |
| <img width="1568" height="287"
alt="01-greyed-execute-to-operator-during-run"
src="https://github.com/user-attachments/assets/aa0193fb-3df8-4fc4-b6e7-588ac8b62c8c";
/> | <img width="1312" height="773"
alt="03-after-fix-greyed-item-clicked-same-run-continues"
src="https://github.com/user-attachments/assets/660049f0-8925-40a8-b83c-50d314a96ea2";
/> |

**Changes.**

1. `context-menu.component.ts`: new `onExecuteUpToOperator()` that
returns early unless `canExecuteOperator()` holds, in the style of
`onCopy`/`onPaste`/`onCut`/`onDelete`; the template binds to it. Same
shape as `onClickComputingUnitRow` in
`computing-unit-selection.component.html`.
2. `context-menu.component.html`: the `(click)` on the
hardcoded-disabled "reuse result" item is removed. "remove reusing
result" keeps its binding.
3. `context-menu.component.spec.ts`: `clickItem` dispatches a real DOM
`MouseEvent` instead of `triggerEventHandler("click", null)`, so the
nz-menu-item host listener and the template binding both run as in the
browser; an `isItemDisabled(label)` helper reads `nzDisabled` from the
rendered `NzMenuItemComponent`.

### Any related issues, documentation, discussions?

Closes #8966

### How was this PR tested?

New tests in `context-menu.component.spec.ts`: "execute to this
operator" does nothing while greyed out (operator invalid, workflow not
modifiable, operator disabled), is not offered with more than one
operator highlighted, and checks the state at click time rather than at
the last render; "reuse result" renders greyed out and does nothing when
clicked. The existing enabled-path test still passes through the real
click.

```
cd frontend
NODE_OPTIONS="--no-experimental-webstorage" npx ng test --watch=false --include 
src/app/workspace/component/workflow-editor/context-menu/context-menu/context-menu.component.spec.ts
# 50 passed (50)
NODE_OPTIONS="--no-experimental-webstorage" npx ng test --watch=false
# 235 files, 6617 passed | 1 skipped
npx tsc --noEmit -p tsconfig.json; npx eslint <changed files>; npx prettier 
--check <changed files>   # clean
```

Mutation check: removing the guard in `onExecuteUpToOperator()` fails
the three "does nothing" tests and the click-time test; restoring the
`(click)` on "reuse result" fails its test. (`NODE_OPTIONS` is only
needed locally on Node 25; CI runs Node 24.)

Manual check in Chrome on the local stack: Text Input -> Python UDF
yielding once per second -> Python Lambda; Run; right-click the Python
Lambda while running and click the greyed "execute to this operator". On
main a second execution started and the first was shut down; on this
branch the same execution keeps running and no second
`workflow_executions` row appears.

### Was this PR authored or co-authored using generative AI tooling?

Yes. Generated-by: Claude Code (claude-fable-5-1). Co-authored with
Claude; the author reviewed the change before submission.

Co-authored-by: Kunwoo (Chris) <[email protected]>

Report URL: https://github.com/apache/texera/actions/runs/40448224145

With regards,
GitHub Actions via GitBox

Reply via email to