This is an automated email from the ASF dual-hosted git repository.

tangyun pushed a commit to branch release-1.17
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/release-1.17 by this push:
     new 050db0110c1 [FLINK-32186][runtime-web] Support subtask stack 
auto-search when redirecting from subtask backpressure tab
050db0110c1 is described below

commit 050db0110c16d404e18649cee0d0e1a7b23f6024
Author: Yu Chen <yuchen.e...@gmail.com>
AuthorDate: Fri May 26 00:16:26 2023 +0800

    [FLINK-32186][runtime-web] Support subtask stack auto-search when 
redirecting from subtask backpressure tab
---
 ...job-overview-drawer-backpressure.component.html |  4 ++++
 .../task-manager-thread-dump.component.html        |  1 +
 .../task-manager-thread-dump.component.ts          | 28 +++++++++++++++++++++-
 3 files changed, 32 insertions(+), 1 deletion(-)

diff --git 
a/flink-runtime-web/web-dashboard/src/app/pages/job/overview/backpressure/job-overview-drawer-backpressure.component.html
 
b/flink-runtime-web/web-dashboard/src/app/pages/job/overview/backpressure/job-overview-drawer-backpressure.component.html
index f99c32e8794..9ecc8cb0c77 100644
--- 
a/flink-runtime-web/web-dashboard/src/app/pages/job/overview/backpressure/job-overview-drawer-backpressure.component.html
+++ 
b/flink-runtime-web/web-dashboard/src/app/pages/job/overview/backpressure/job-overview-drawer-backpressure.component.html
@@ -95,6 +95,10 @@
                 mapOfSubtask.get(subtask['subtask'])['taskmanager-id'],
                 'thread-dump'
               ]"
+              [queryParams]="{
+                vertexName: selectedVertex.detail.name + ' (' + 
(subtask['subtask'] + 1) + '/'
+              }"
+              target="_blank"
             >
               Dump
             </a>
diff --git 
a/flink-runtime-web/web-dashboard/src/app/pages/task-manager/thread-dump/task-manager-thread-dump.component.html
 
b/flink-runtime-web/web-dashboard/src/app/pages/task-manager/thread-dump/task-manager-thread-dump.component.html
index f7572891985..30941b13709 100644
--- 
a/flink-runtime-web/web-dashboard/src/app/pages/task-manager/thread-dump/task-manager-thread-dump.component.html
+++ 
b/flink-runtime-web/web-dashboard/src/app/pages/task-manager/thread-dump/task-manager-thread-dump.component.html
@@ -21,6 +21,7 @@
   [nzLoading]="loading"
   [ngModel]="dump"
   [nzEditorOption]="editorOptions"
+  (nzEditorInitialized)="nzEditorInitialized($event)"
 ></nz-code-editor>
 <flink-addon-compact
   [downloadHref]="downloadUrl"
diff --git 
a/flink-runtime-web/web-dashboard/src/app/pages/task-manager/thread-dump/task-manager-thread-dump.component.ts
 
b/flink-runtime-web/web-dashboard/src/app/pages/task-manager/thread-dump/task-manager-thread-dump.component.ts
index e4ad2d90b06..fcfaf4c2b53 100644
--- 
a/flink-runtime-web/web-dashboard/src/app/pages/task-manager/thread-dump/task-manager-thread-dump.component.ts
+++ 
b/flink-runtime-web/web-dashboard/src/app/pages/task-manager/thread-dump/task-manager-thread-dump.component.ts
@@ -30,9 +30,12 @@ import {
   TASK_MANAGER_MODULE_DEFAULT_CONFIG
 } from '@flink-runtime-web/pages/task-manager/task-manager.config';
 import { ConfigService, TaskManagerService } from 
'@flink-runtime-web/services';
+import { editor } from 'monaco-editor';
 import { NzCodeEditorModule } from 'ng-zorro-antd/code-editor';
 import { EditorOptions } from 'ng-zorro-antd/code-editor/typings';
 
+import IStandaloneCodeEditor = editor.IStandaloneCodeEditor;
+
 @Component({
   selector: 'flink-task-manager-thread-dump',
   templateUrl: './task-manager-thread-dump.component.html',
@@ -45,6 +48,7 @@ export class TaskManagerThreadDumpComponent implements 
OnInit, OnDestroy {
   public editorOptions: EditorOptions;
 
   public dump = '';
+  public vertexName = '';
   public loading = true;
   public taskManagerId: string;
   public downloadUrl = '';
@@ -66,7 +70,9 @@ export class TaskManagerThreadDumpComponent implements 
OnInit, OnDestroy {
     this.taskManagerId = 
this.activatedRoute.parent!.snapshot.params.taskManagerId;
     this.downloadUrl = 
`${this.configService.BASE_URL}/taskmanagers/${this.taskManagerId}/thread-dump`;
     this.downloadName = `taskmanager_${this.taskManagerId}_thread_dump`;
-    this.reload();
+    this.activatedRoute.queryParams.subscribe(params => {
+      this.vertexName = decodeURIComponent(params.vertexName);
+    });
   }
 
   public ngOnDestroy(): void {
@@ -74,6 +80,26 @@ export class TaskManagerThreadDumpComponent implements 
OnInit, OnDestroy {
     this.destroy$.complete();
   }
 
+  public nzEditorInitialized(editor: IStandaloneCodeEditor): void {
+    if (this.vertexName !== undefined) {
+      editor.onDidChangeModelContent(_ => {
+        const model = editor.getModel();
+        // Note that legacy source will prefix with `Legacy Source Thread - `, 
we search it first.
+        let results = model!.findMatches(`"Legacy Source Thread - 
${this.vertexName}`, false, false, true, null, false);
+        if (results.length == 0) {
+          results = model!.findMatches(`"${this.vertexName}`, false, false, 
true, null, false);
+        }
+        if (results.length > 0) {
+          editor.setSelection(results[0].range);
+          editor.getAction('actions.find').run();
+          editor.getAction('editor.action.nextMatchFindAction').run();
+        }
+      });
+    }
+    // loading thread dump after editor view ready
+    this.reload();
+  }
+
   public reload(): void {
     this.loading = true;
     this.cdr.markForCheck();

Reply via email to