Skip to content

fix(frontend): restore Regions and Status canvas toggles#5160

Merged
bobbai00 merged 6 commits into
apache:mainfrom
bobbai00:fix/5120-region-canvas-toggle
May 31, 2026
Merged

fix(frontend): restore Regions and Status canvas toggles#5160
bobbai00 merged 6 commits into
apache:mainfrom
bobbai00:fix/5120-region-canvas-toggle

Conversation

@bobbai00

@bobbai00 bobbai00 commented May 22, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Restores the Regions and Status toggles under View, both of which broke after #4495 switched these elements from JointJS visibility attributes to CSS classes.

  • Regions: region visibility is now a shared, persistent flag on JointGraphWrapper (setRegionsDisplayed / getRegionsDisplayed / stream). The editor applies it to the shared JointJS model both when the flag changes and whenever regions are recreated on a RegionUpdateEvent. Because the model is shared, the toggle drives both the main canvas (Region layer renders on mini-map but not on main workflow canvas #5120) and the mini-map (Mini map still shows Region highlighting when “Regions” is turned off #4027), and it survives the region elements being recreated during execution (previously regions went hidden mid-run even with the toggle on). The menu toggle just sets the flag; the editor owns applying it. The hide-region CSS class/SCSS rule are removed.
  • Status (workflow-editor.component.scss, workflow-editor.component.ts, menu.component.ts): re-added the hide-operator-status SCSS rule (retargeted to the renamed .texera-operator-state element), added the default class so Status starts hidden, and fixed the stale .operator-status selector in applyOperatorStatusPosition().

Unit tests added for the toggle delegation, status repositioning, the default hide-operator-status class, and region visibility across creation / recreation / toggling.

Here is a demo of the style after fix:
2026-05-30 11 35 33

Any related issues, documentation, discussions?

Closes #5120

Regression from #4495.

How was this PR tested?

Manual + unit tests.

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

Generated-by: Claude Opus 4.8 (1M context)

@github-actions github-actions Bot added fix frontend Changes related to the frontend GUI labels May 22, 2026
@aglinxinyuan

Copy link
Copy Markdown
Contributor

This fix doesn't seem to be correct. A significant amount of region-related code was removed in #4495, so I'd expect more changes to be needed here.

Please manually test the feature and verify that it works as expected before requesting another review. It's quite inefficient for reviewers to be responsible for testing the feature and then reporting issues back to the author. Otherwise, the review process can easily turn into several rounds of back-and-forth before the fix is actually validated.

Both toggles broke after apache#4495 changed visibility from JointJS
attributes to CSS classes.

- Regions: drop the dead body/visibility loop; toggle the hide-region
  class only.
- Status: re-add the hide-operator-status SCSS rule (retargeted to the
  renamed .texera-operator-state element), add the default class so
  Status starts hidden, and fix the stale selector in
  applyOperatorStatusPosition.
@bobbai00 bobbai00 force-pushed the fix/5120-region-canvas-toggle branch from 4f82cd1 to 466fb7f Compare May 30, 2026 08:40
@bobbai00 bobbai00 changed the title fix(frontend): toggle hide-region class on main canvas fix(frontend): restore Regions and Status canvas toggles May 30, 2026
@bobbai00 bobbai00 requested a review from aglinxinyuan May 30, 2026 08:43
@bobbai00

Copy link
Copy Markdown
Contributor Author

This fix doesn't seem to be correct. A significant amount of region-related code was removed in #4495, so I'd expect more changes to be needed here.

Please manually test the feature and verify that it works as expected before requesting another review. It's quite inefficient for reviewers to be responsible for testing the feature and then reporting issues back to the author. Otherwise, the review process can easily turn into several rounds of back-and-forth before the fix is actually validated.

My bad, I should make the PR as drafts when they are not ready for review. Now it is ready for a review. Please check

@codecov-commenter

codecov-commenter commented May 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.40%. Comparing base (e2bd473) to head (a42d6fc).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...onent/workflow-editor/workflow-editor.component.ts 0.00% 7 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5160      +/-   ##
============================================
+ Coverage     49.16%   49.40%   +0.23%     
+ Complexity     2385     2381       -4     
============================================
  Files          1051     1051              
  Lines         40350    40396      +46     
  Branches       4279     4292      +13     
============================================
+ Hits          19838    19957     +119     
+ Misses        19353    19260      -93     
- Partials       1159     1179      +20     
Flag Coverage Δ *Carryforward flag
access-control-service 41.89% <ø> (ø) Carriedforward from b0cae9d
agent-service 33.76% <ø> (ø) Carriedforward from b0cae9d
amber 51.63% <ø> (-0.04%) ⬇️ Carriedforward from b0cae9d
computing-unit-managing-service 0.00% <ø> (ø) Carriedforward from b0cae9d
config-service 0.00% <ø> (ø) Carriedforward from b0cae9d
file-service 38.42% <ø> (ø) Carriedforward from b0cae9d
frontend 41.71% <50.00%> (+0.63%) ⬆️
python 90.79% <ø> (ø) Carriedforward from b0cae9d
workflow-compiling-service 56.81% <ø> (ø) Carriedforward from b0cae9d

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aglinxinyuan aglinxinyuan enabled auto-merge May 30, 2026 08:52
@aglinxinyuan aglinxinyuan disabled auto-merge May 30, 2026 08:53

@aglinxinyuan aglinxinyuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a reason we didn't use the implementation used in this PR, even though it was cleaner. It will cause the issue described in issue #4027.

Tested locally, and the mini map still shows the region when it's disabled:
Image

Bob Bai added 3 commits May 30, 2026 09:53
Restore the per-element body/visibility flip in toggleRegion that the
previous cleanup removed; the mini-map shares the model but has no
hide-region class, so it relies on this attribute (regression of apache#4027).
Both the CSS class (main canvas, apache#5120) and the attribute (mini-map,
apache#4027) are needed, now documented inline.

Add unit tests for toggleRegion, toggleStatus, the status-label
repositioning, and the default hide-region / hide-operator-status
canvas classes.
Switch regions back to the pure body/visibility approach from apache#4112.
apache#4495 had regions hidden via a hide-region CSS class on the main paper
only, with the element defaulting to visible — so the mini-map (which
shares the model but not the class) showed region hulls regardless of
the toggle, and freshly-created regions reappeared on every execution
update.

Now the region element defaults to visibility: hidden and toggleRegion
flips body/visibility on the shared model, so both the main canvas and
the mini-map stay in sync (apache#5120 and apache#4027). Drops the hide-region class
and SCSS rule. Tests updated accordingly.
Regions are recreated on every RegionUpdateEvent during execution, so a
toggle that only flipped existing elements was lost as soon as the next
update arrived — regions stayed hidden mid-run even with the toggle on.

Make the Regions toggle a shared, persistent flag on JointGraphWrapper.
The editor reapplies it to the shared JointJS model both when the flag
changes and whenever regions are recreated, so the main canvas and the
mini-map stay in sync on and off during execution (apache#5120, apache#4027).

The menu toggle now just sets the flag; the editor owns applying it.
Tests cover creation-while-on, recreation, and toggling existing regions.
@Yicong-Huang

Copy link
Copy Markdown
Contributor

on top of that, please ensure we add enough tests to at least make sure coverage is enough. We don't want this fix to cause more bugs. @bobbai00 please prioritize this PR.

@bobbai00

Copy link
Copy Markdown
Contributor Author

There was a reason we didn't use the implementation used in this PR, even though it was cleaner. It will cause the issue described in issue #4027.

Tested locally, and the mini map still shows the region when it's disabled: Image

I have fixed this issue. Please check again

@bobbai00 bobbai00 requested a review from aglinxinyuan May 30, 2026 18:37
Direct tests for setRegionsDisplayed/getRegionsDisplayed and the
BehaviorSubject stream (default, update, replay-and-change).

@aglinxinyuan aglinxinyuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Tested locally.

@bobbai00 bobbai00 added this pull request to the merge queue May 31, 2026
Merged via the queue into apache:main with commit e650919 May 31, 2026
16 checks passed
@bobbai00 bobbai00 deleted the fix/5120-region-canvas-toggle branch May 31, 2026 01:45
yangzhang75 pushed a commit to yangzhang75/texera that referenced this pull request Jun 22, 2026
### What changes were proposed in this PR?

Restores the **Regions** and **Status** toggles under View, both of
which broke after apache#4495 switched these elements from JointJS
`visibility` attributes to CSS classes.

- **Regions**: region visibility is now a shared, persistent flag on
`JointGraphWrapper` (`setRegionsDisplayed` / `getRegionsDisplayed` /
stream). The editor applies it to the shared JointJS model both when the
flag changes and whenever regions are recreated on a
`RegionUpdateEvent`. Because the model is shared, the toggle drives both
the main canvas (apache#5120) and the mini-map (apache#4027), and it survives the
region elements being recreated during execution (previously regions
went hidden mid-run even with the toggle on). The menu toggle just sets
the flag; the editor owns applying it. The `hide-region` CSS class/SCSS
rule are removed.
- **Status** (`workflow-editor.component.scss`,
`workflow-editor.component.ts`, `menu.component.ts`): re-added the
`hide-operator-status` SCSS rule (retargeted to the renamed
`.texera-operator-state` element), added the default class so Status
starts hidden, and fixed the stale `.operator-status` selector in
`applyOperatorStatusPosition()`.

Unit tests added for the toggle delegation, status repositioning, the
default `hide-operator-status` class, and region visibility across
creation / recreation / toggling.

Here is a demo of the style after fix:
<img width="1707" height="1162" alt="2026-05-30 11 35 33"
src="https://github.com/user-attachments/assets/ae5fc0d3-76f1-4bf8-914e-2644f89b46c2"
/>


### Any related issues, documentation, discussions?

Closes apache#5120

Regression from apache#4495.

### How was this PR tested?
Manual + unit tests.


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

Generated-by: Claude Opus 4.8 (1M context)

---------

Co-authored-by: Bob Bai <bobbai0509@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Region layer renders on mini-map but not on main workflow canvas

4 participants