aglinxinyuan commented on code in PR #9060:
URL: https://github.com/apache/texera/pull/9060#discussion_r4418732793


##########
frontend/src/app/workspace/component/result-panel/result-panel.component.ts:
##########
@@ -132,10 +101,7 @@ export class ResultPanelComponent implements OnInit, 
OnDestroy {
     const [xOffset, yOffset, _] = calculateTotalTranslate3d(translates);
     this.returnPosition = { x: -xOffset, y: -yOffset };
     this.updateReturnPosition(DEFAULT_HEIGHT, this.height);
-    this.registerAutoRerenderResultPanel();
-    this.registerAutoOpenResultPanel();
-    this.registerResultClearedHandler();
-    this.handleResultPanelForVersionPreview();
+    this.registerFollowHighlight();

Review Comment:
   With `registerAutoOpenResultPanel` gone, starting a run no longer selects 
the first Python UDF. When a UDF hits an exception, the console shows every 
operator and has no debug input until the user clicks its tag. Was that 
intended? Dropping the sink selection on completion makes sense now.



##########
frontend/src/app/workspace/component/result-panel/result-panel.component.html:
##########
@@ -89,31 +89,12 @@
     <h4
       id="title"
       cdkDragHandle>
-      Result Panel{{operatorTitle ? ': ' + operatorTitle : ''}}
+      Console
     </h4>
-    <nz-tabs
+    <texera-console-frame

Review Comment:
   Since #8637 (merged 10-28), main's bottom panel shows an "AI Fix" tab for a 
selected Python UDF with a console error. It is added through 
`frameComponentConfigs` in `result-panel.component.ts`, and that is the only 
place `AiFixFrameComponent` is used. This PR replaces those tabs with the 
console alone, so the main merge (it conflicts in 
`result-panel.component.{ts,html,spec.ts}`) needs to decide where AI Fix goes. 
Taking this side as is drops the tab and leaves the AI fixer unreachable.



##########
frontend/src/app/workspace/component/result-panel/console-frame/console-frame.component.ts:
##########
@@ -316,4 +343,67 @@ export class ConsoleFrameComponent implements OnInit, 
OnChanges {
   getMessageLabel(message: ConsoleMessage): string {
     return this.labelMapping.get(message.msgType.name) ?? "";
   }
+
+  /** The operator a shown message came from, when it came from one still on 
the canvas. */
+  messageOperatorId(message: ConsoleMessage): string | undefined {
+    const operatorId = this.messageOperator.get(message);
+    return isDefined(operatorId) && 
this.workflowActionService.getTexeraGraph().hasOperator(operatorId)
+      ? operatorId
+      : undefined;
+  }
+
+  operatorLabel(operatorId: string): string {
+    const graph = this.workflowActionService.getTexeraGraph();
+    if (!graph.hasOperator(operatorId)) return operatorId;
+    const operator = graph.getOperator(operatorId);
+    return operator.customDisplayName ?? operator.operatorType;
+  }
+
+  /** Show only this operator's messages. The panel follows the highlight, so 
this highlights it. */
+  showOperator(operatorId: string): void {
+    this.workflowActionService.highlightOperators(false, operatorId);
+  }
+
+  /** Back to every operator's messages, by clearing the highlight the panel 
follows. */
+  showAllOperators(): void {
+    const wrapper = this.workflowActionService.getJointGraphWrapper();
+    
wrapper.unhighlightOperators(...wrapper.getCurrentHighlightedOperatorIDs());
+  }
+
+  /** The errors that stopped the run or the compilation, as console messages. 
*/
+  private fatalErrorMessages(): OperatorConsoleMessage[] {
+    const errors: WorkflowFatalError[] = [
+      ...this.executeWorkflowService.getErrorMessages(),
+      
...Object.values(this.workflowCompilingService.getWorkflowCompilationErrors()),
+    ];
+    return errors.map(error => {
+      // The same error gives the same message on every render. A new one each 
time would read as
+      // a message just arrived, and the list would jump to its end while the 
user scrolls up.
+      let row = this.fatalErrorRows.get(error);

Review Comment:
   Compilation errors are new objects on every compile response, so this 
`WeakMap` misses on each recompile. While a compile error is shown, every edit 
scrolls the console to its end. Keying the row by the error's content would 
keep it in place.



##########
frontend/src/app/workspace/component/result-panel/console-frame/console-frame.component.ts:
##########
@@ -316,4 +343,67 @@ export class ConsoleFrameComponent implements OnInit, 
OnChanges {
   getMessageLabel(message: ConsoleMessage): string {
     return this.labelMapping.get(message.msgType.name) ?? "";
   }
+
+  /** The operator a shown message came from, when it came from one still on 
the canvas. */
+  messageOperatorId(message: ConsoleMessage): string | undefined {
+    const operatorId = this.messageOperator.get(message);
+    return isDefined(operatorId) && 
this.workflowActionService.getTexeraGraph().hasOperator(operatorId)
+      ? operatorId
+      : undefined;
+  }
+
+  operatorLabel(operatorId: string): string {
+    const graph = this.workflowActionService.getTexeraGraph();
+    if (!graph.hasOperator(operatorId)) return operatorId;
+    const operator = graph.getOperator(operatorId);
+    return operator.customDisplayName ?? operator.operatorType;
+  }
+
+  /** Show only this operator's messages. The panel follows the highlight, so 
this highlights it. */
+  showOperator(operatorId: string): void {
+    this.workflowActionService.highlightOperators(false, operatorId);
+  }
+
+  /** Back to every operator's messages, by clearing the highlight the panel 
follows. */
+  showAllOperators(): void {
+    const wrapper = this.workflowActionService.getJointGraphWrapper();
+    
wrapper.unhighlightOperators(...wrapper.getCurrentHighlightedOperatorIDs());

Review Comment:
   This calls the joint wrapper's `unhighlightOperators` directly, which skips 
the awareness update in `WorkflowActionService.unhighlightOperators`, so 
co-editors keep seeing the highlight. `showOperator` already goes through the 
action service.



-- 
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]

Reply via email to