Add operator drag-and-connect controller
- Dominant language
- Scala
- Stars
- 314
- Forks
- 187
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 214
Description
### Feature Summary
Step 3 of the operator-demo video generator: add the controller that places an operator on the canvas and wires it up.
This is the first step whose output is visible in the recording: every demo starts by dragging the operator being demoed onto the canvas of an already-imported sample workflow and connecting it to the data flowing through it.
### Proposed Solution or Design
Add a new `OperatorControllerBuilder` to the Playwright layer. It finds the operator in the left panel, drags it onto the canvas near the sample workflow, and connects its ports.
Finding the operator: It navigates the panel the way a user would rather than guessing at the DOM. It expands the operator's group path, taken from the operator's own metadata (operatorGroupName resolved against the group tree), since the panel nests subgroups and a collapsed group renders no items at all: for example User-defined Functions, then Python, then the item. Once the group is open the item is picked by its per-operator test id (operator-item-), with an exact-label match as a secondary. If the item still cannot be reached, it falls back to typing the operator name into the panel's search box and taking the first match.
Connecting operator: The wiring strategy is based on the operator's input-port count:
- 0 inputs: place it on the canvas with no upstream connection.
- 1 input: connect it to the sample workflow's source.
- 2+ inputs: connect it to two upstream operators.
```
new OperatorControllerBuilder(ctx)
.insertViaDrag(
operatorName,
operatorType = Some(operatorType),
dragNextTo = Some("CSVFileScan-operator-"),
autoConnectToAnchor = true
)
.execute()
```
Frontend hooks: Adds the data-testid attributes this controller relies on: the left-panel Operators button, the operator search input, and a per-operator id on each list item (operator-item-); extends the guard test.
### Affected Area
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.