yangzhang75 commented on code in PR #8429:
URL: https://github.com/apache/texera/pull/8429#discussion_r3939699036
##########
frontend/src/app/workspace/component/workflow-form/workflow-form.component.ts:
##########
@@ -158,6 +175,28 @@ export class WorkflowFormComponent implements OnInit,
OnDestroy {
this.workflowActionService.disableWorkflowModification();
}
+ /** Open or close the workflow preview; opening it builds the canvas the
first time. */
+ public toggleWorkflow(): void {
+ this.workflowOpen = !this.workflowOpen;
+ if (this.workflowOpen) {
+ this.openWorkflowStrip();
+ }
+ }
+
+ /**
+ * Reveal the strip, then build the canvas a frame later (so JointJS
measures the strip's
+ * real size, not a zero-sized frame that misroutes links), then centre the
graph a frame
+ * after that so the fit runs against a canvas that exists. The editor keeps
its own paper
+ * sized via its container ResizeObserver, so nothing more is needed here.
+ */
+ private openWorkflowStrip(): void {
+ this.later(() => {
+ this.workflowEverOpened = true;
+ this.cdr.detectChanges();
+ this.later(() =>
this.workflowActionService.getTexeraGraph().triggerCenterEvent());
+ });
+ }
Review Comment:
Fixed in 8f4d7bd. `openWorkflowStrip` now rechecks `workflowOpen` inside
each deferred frame: if the reader collapses the strip before the build frame,
the children are no longer mounted into a hidden (0-sized) body, and centering
is skipped too. Added a test (open then collapse in the same tick -> the canvas
is never built). So the mini-map only ever mounts while the strip is visible.
##########
frontend/src/app/workspace/component/workflow-editor/workflow-editor.component.ts:
##########
@@ -118,7 +118,22 @@ export class WorkflowEditorComponent implements OnInit,
AfterViewInit, OnDestroy
metricLabel: string;
heatLabel: string;
} | null = null;
- private interactive: boolean = true;
+ private paperInteractive: boolean = true;
+ // Keeps the paper sized to its OWN container (not just the window) and
rebuilds cell geometry
+ // when the container goes 0 -> real size. Needed by embedded previews like
the Form View strip,
+ // which toggles this editor's container via display:none.
+ private paperResizeObserver?: ResizeObserver;
+
+ /**
+ * Set by a view that shows the graph but must never re-shape it. Separate
from the
+ * workflow-modification lock (which also gates property editing, so reusing
it would disable
+ * the property panel); this gates dragging, linking and deleting only.
+ */
+ @Input() structureLocked = false;
Review Comment:
Good catch on the gap. In this PR it is not reachable: the Form View calls
`disableWorkflowModification()`, so the context menu's structural commands
(which follow that flag) are already locked -- the graph cannot be deleted
through any path here. `structureLocked` locks the paper's own interactions
(drag, link, keyboard delete/cut/port). The case you describe -- modification
enabled while the structure stays locked -- first arises in the authoring
slice; carrying `structureLocked` into the context menu belongs there, so it is
not added now as a gate that would be redundant/dead in this read-only PR. I
have tightened the `structureLocked` doc comment to state exactly this (what it
locks, that the menu follows the modification flag, and that authoring must
extend it). Leaving this thread open for that follow-up.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]