This is an automated email from the ASF dual-hosted git repository.
xiaozhenliu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/texera.git
The following commit(s) were added to refs/heads/main by this push:
new 127c26abe7 fix(ui): add links to region display (#4226)
127c26abe7 is described below
commit 127c26abe746ac87fc9b45533f8d7b76d4b90f06
Author: Grace Chia <[email protected]>
AuthorDate: Sun Feb 22 11:58:57 2026 -0800
fix(ui): add links to region display (#4226)
<!--
Thanks for sending a pull request (PR)! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines:
[Contributing to
Texera](https://github.com/apache/texera/blob/main/CONTRIBUTING.md)
2. Ensure you have added or run the appropriate tests for your PR
3. If the PR is work in progress, mark it a draft on GitHub.
4. Please write your PR title to summarize what this PR proposes, we
are following Conventional Commits style for PR titles as well.
5. Be sure to keep the PR description updated to reflect all changes.
-->
### What changes were proposed in this PR?
<!--
Please clarify what changes you are proposing. The purpose of this
section
is to outline the changes. Here are some tips for you:
1. If you propose a new API, clarify the use case for a new API.
2. If you fix a bug, you can clarify why it is a bug.
3. If it is a refactoring, clarify what has been changed.
3. It would be helpful to include a before-and-after comparison using
screenshots or GIFs.
4. Please consider writing useful notes for better and faster reviews.
-->
This PR adds links to the frontend region display calculation, so that
the region fully covers links.
Before:
<img width="878" height="603" alt="image"
src="https://github.com/user-attachments/assets/e572edf9-ee0e-4d80-892d-36547bad97be"
/>
After:
<img width="960" height="631" alt="image"
src="https://github.com/user-attachments/assets/03a0fef8-684a-483d-8a0c-3fda380eae69"
/>
### Any related issues, documentation, discussions?
<!--
Please use this section to link other resources if not mentioned
already.
1. If this PR fixes an issue, please include `Fixes #1234`, `Resolves
#1234`
or `Closes #1234`. If it is only related, simply mention the issue
number.
2. If there is design documentation, please add the link.
3. If there is a discussion in the mailing list, please add the link.
-->
Closes #4163
### How was this PR tested?
<!--
If tests were added, say they were added here. Or simply mention that if
the PR
is tested with existing test cases. Make sure to include/update test
cases that
check the changes thoroughly including negative and positive cases if
possible.
If it was tested in a way different from regular unit tests, please
clarify how
you tested step by step, ideally copy and paste-able, so that other
reviewers can
test and check, and descendants can verify in the future. If tests were
not added,
please describe why they were not added and/or why it was difficult to
add.
-->
Manual testing
### Was this PR authored or co-authored using generative AI tooling?
<!--
If generative AI tooling has been used in the process of authoring this
PR,
please include the phrase: 'Generated-by: ' followed by the name of the
tool
and its version. If no, write 'No'.
Please refer to the [ASF Generative Tooling
Guidance](https://www.apache.org/legal/generative-tooling.html) for
details.
-->
No
---------
Co-authored-by: Xinyuan Lin <[email protected]>
---
.../workflow-editor/workflow-editor.component.ts | 48 ++++++++++++++++++++--
1 file changed, 45 insertions(+), 3 deletions(-)
diff --git
a/frontend/src/app/workspace/component/workflow-editor/workflow-editor.component.ts
b/frontend/src/app/workspace/component/workflow-editor/workflow-editor.component.ts
index b53fa4e663..f1532bf9a9 100644
---
a/frontend/src/app/workspace/component/workflow-editor/workflow-editor.component.ts
+++
b/frontend/src/app/workspace/component/workflow-editor/workflow-editor.component.ts
@@ -392,9 +392,9 @@ export class WorkflowEditorComponent implements OnInit,
AfterViewInit, OnDestroy
}
private updateRegionElement(regionElement: joint.dia.Element, operators:
joint.dia.Cell[]) {
+ const padding = 15;
const points = operators.flatMap(op => {
- const { x, y, width, height } = op.getBBox(),
- padding = 15;
+ const { x, y, width, height } = op.getBBox();
return [
[x - padding, y - padding],
[x + width + padding, y - padding],
@@ -402,7 +402,49 @@ export class WorkflowEditorComponent implements OnInit,
AfterViewInit, OnDestroy
[x + width + padding, y + height + padding + 10],
];
});
- regionElement.attr("body/d",
line().curve(curveCatmullRomClosed)(concaveman(points, 2, 0) as [number,
number][]));
+
+ const links = [...this.getRegionLinks(operators)];
+ const link_points = links.flatMap(link => {
+ const linkView = this.paper.findViewByModel(link as joint.dia.Link);
+ const bbox = (linkView as joint.dia.LinkView).getConnection().bbox();
+ if (!bbox) {
+ return [];
+ }
+ const { x, y, width, height } = bbox;
+ return [
+ [x - padding, y - padding],
+ [x + width + padding, y - padding],
+ [x - padding, y + height + padding],
+ [x + width + padding, y + height + padding],
+ ];
+ });
+ points.push(...link_points);
+ regionElement.attr(
+ "body/d",
+ line().curve(curveCatmullRomClosed)(concaveman(points, Infinity, 0) as
[number, number][])
+ );
+ }
+
+ private getRegionLinks(ops: joint.dia.Cell[]): Set<joint.dia.Link> {
+ const ops_set = new Set(ops);
+ const links_set = new Set<joint.dia.Link>();
+ for (const op of ops) {
+ for (const link of this.paper.model.getConnectedLinks(op)) {
+ if (links_set.has(link)) {
+ continue;
+ }
+ const sourceCell = link.getSourceCell();
+ if (sourceCell && !ops_set.has(sourceCell)) {
+ continue;
+ }
+ const targetCell = link.getTargetCell();
+ if (targetCell && !ops_set.has(targetCell)) {
+ continue;
+ }
+ links_set.add(link);
+ }
+ }
+ return links_set;
}
/**