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

vogievetsky pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git


The following commit(s) were added to refs/heads/master by this push:
     new daaa7266303 Web console: fix go to task selecting correct task type 
(#17788)
daaa7266303 is described below

commit daaa726630302302d93294438cafc200ff62ee31
Author: Vadim Ogievetsky <[email protected]>
AuthorDate: Fri Mar 14 09:25:34 2025 -0700

    Web console: fix go to task selecting correct task type (#17788)
    
    * fix go to task selecting correct task type
    
    * support autocompact also
    
    * support scheduled_batch, refactor
    
    * one more state and update tests
---
 .../__snapshots__/supervisors-view.spec.tsx.snap   |   4 +-
 .../views/supervisors-view/supervisors-view.tsx    | 105 +++++++++++++--------
 2 files changed, 68 insertions(+), 41 deletions(-)

diff --git 
a/web-console/src/views/supervisors-view/__snapshots__/supervisors-view.spec.tsx.snap
 
b/web-console/src/views/supervisors-view/__snapshots__/supervisors-view.spec.tsx.snap
index 273fa44d9db..a3fdd921278 100644
--- 
a/web-console/src/views/supervisors-view/__snapshots__/supervisors-view.spec.tsx.snap
+++ 
b/web-console/src/views/supervisors-view/__snapshots__/supervisors-view.spec.tsx.snap
@@ -172,7 +172,7 @@ exports[`SupervisorsView matches snapshot 1`] = `
           "Header": "Type",
           "accessor": "type",
           "show": true,
-          "width": 80,
+          "width": 120,
         },
         {
           "Cell": [Function],
@@ -188,7 +188,7 @@ exports[`SupervisorsView matches snapshot 1`] = `
           "accessor": "detailed_state",
           "id": "detailed_state",
           "show": true,
-          "width": 150,
+          "width": 170,
         },
         {
           "Cell": [Function],
diff --git a/web-console/src/views/supervisors-view/supervisors-view.tsx 
b/web-console/src/views/supervisors-view/supervisors-view.tsx
index 89ad8ebfcb9..a81fda3d7f0 100644
--- a/web-console/src/views/supervisors-view/supervisors-view.tsx
+++ b/web-console/src/views/supervisors-view/supervisors-view.tsx
@@ -138,7 +138,7 @@ export interface SupervisorsViewProps {
   goToDatasource(datasource: string): void;
   goToQuery(queryWithContext: QueryWithContext): void;
   goToStreamingDataLoader(supervisorId: string): void;
-  goToTasks(supervisorId: string, type: string): void;
+  goToTasks(supervisorId: string, type: string | undefined): void;
   capabilities: Capabilities;
 }
 
@@ -175,6 +175,7 @@ function detailedStateToColor(detailedState: string): 
string {
     case 'UNHEALTHY_TASKS':
     case 'UNABLE_TO_CONNECT_TO_STREAM':
     case 'LOST_CONTACT_WITH_STREAM':
+    case 'INVALID_SPEC':
       return '#d5100a';
 
     case 'PENDING':
@@ -192,7 +193,8 @@ function detailedStateToColor(detailedState: string): 
string {
     case 'STOPPING':
       return '#e75c06';
 
-    case `SUSPENDED`:
+    case 'SUSPENDED':
+    case 'SCHEDULER_STOPPED':
       return '#ffbf00';
 
     default:
@@ -420,11 +422,8 @@ export class SupervisorsView extends React.PureComponent<
     this.supervisorQueryManager.rerunLastQuery();
   };
 
-  private getSupervisorActions(
-    id: string,
-    supervisorSuspended: boolean,
-    type: string,
-  ): BasicAction[] {
+  private getSupervisorActions(supervisor: SupervisorQueryResultRow): 
BasicAction[] {
+    const { supervisor_id, suspended, type } = supervisor;
     const { goToDatasource, goToStreamingDataLoader } = this.props;
 
     const actions: BasicAction[] = [];
@@ -433,30 +432,37 @@ export class SupervisorsView extends React.PureComponent<
         {
           icon: IconNames.MULTI_SELECT,
           title: 'Go to datasource',
-          onAction: () => goToDatasource(id),
+          onAction: () => goToDatasource(supervisor_id),
         },
         {
           icon: IconNames.CLOUD_UPLOAD,
           title: 'Open in data loader',
-          onAction: () => goToStreamingDataLoader(id),
+          onAction: () => goToStreamingDataLoader(supervisor_id),
         },
       );
     }
 
-    actions.push({
-      icon: supervisorSuspended ? IconNames.PLAY : IconNames.PAUSE,
-      title: supervisorSuspended ? 'Resume' : 'Suspend',
-      onAction: () =>
-        supervisorSuspended
-          ? this.setState({ resumeSupervisorId: id })
-          : this.setState({ suspendSupervisorId: id }),
-    });
+    actions.push(
+      {
+        icon: suspended ? IconNames.PLAY : IconNames.PAUSE,
+        title: suspended ? 'Resume' : 'Suspend',
+        onAction: () =>
+          suspended
+            ? this.setState({ resumeSupervisorId: supervisor_id })
+            : this.setState({ suspendSupervisorId: supervisor_id }),
+      },
+      {
+        icon: IconNames.GANTT_CHART,
+        title: 'Go to tasks',
+        onAction: () => this.goToTasksForSupervisor(supervisor),
+      },
+    );
 
-    if (!supervisorSuspended) {
+    if (!suspended) {
       actions.push({
         icon: IconNames.AUTOMATIC_UPDATES,
         title: 'Handoff early',
-        onAction: () => this.setState({ handoffSupervisorId: id }),
+        onAction: () => this.setState({ handoffSupervisorId: supervisor_id }),
       });
     }
 
@@ -464,21 +470,21 @@ export class SupervisorsView extends React.PureComponent<
       {
         icon: IconNames.STEP_BACKWARD,
         title: `Set ${type === 'kinesis' ? 'sequence numbers' : 'offsets'}`,
-        onAction: () => this.setState({ resetOffsetsSupervisorInfo: { id, type 
} }),
-        disabledReason: supervisorSuspended ? undefined : `Supervisor must be 
suspended`,
+        onAction: () => this.setState({ resetOffsetsSupervisorInfo: { id: 
supervisor_id, type } }),
+        disabledReason: suspended ? undefined : `Supervisor must be suspended`,
       },
       {
         icon: IconNames.STEP_BACKWARD,
         title: 'Hard reset',
         intent: Intent.DANGER,
-        onAction: () => this.setState({ resetSupervisorId: id }),
-        disabledReason: supervisorSuspended ? undefined : `Supervisor must be 
suspended`,
+        onAction: () => this.setState({ resetSupervisorId: supervisor_id }),
+        disabledReason: suspended ? undefined : `Supervisor must be suspended`,
       },
       {
         icon: IconNames.CROSS,
         title: 'Terminate',
         intent: Intent.DANGER,
-        onAction: () => this.setState({ terminateSupervisorId: id }),
+        onAction: () => this.setState({ terminateSupervisorId: supervisor_id 
}),
       },
     );
     return actions;
@@ -672,16 +678,37 @@ export class SupervisorsView extends React.PureComponent<
   private onSupervisorDetail(supervisor: SupervisorQueryResultRow) {
     this.setState({
       supervisorTableActionDialogId: supervisor.supervisor_id,
-      supervisorTableActionDialogActions: this.getSupervisorActions(
-        supervisor.supervisor_id,
-        supervisor.suspended,
-        supervisor.type,
-      ),
+      supervisorTableActionDialogActions: 
this.getSupervisorActions(supervisor),
     });
   }
 
+  private goToTasksForSupervisor(supervisor: SupervisorQueryResultRow) {
+    const { goToTasks } = this.props;
+    switch (supervisor.type) {
+      case 'kafka':
+      case 'kinesis':
+        goToTasks(supervisor.supervisor_id, `index_${supervisor.type}`);
+        return;
+
+      case 'autocompact':
+        goToTasks(supervisor.supervisor_id.replace(/^autocompact__/, ''), 
'compact');
+        return;
+
+      case 'scheduled_batch':
+        goToTasks(
+          supervisor.supervisor_id.replace(/^scheduled_batch__/, 
'').replace(/__[0-9a-f-]+$/, ''),
+          'query_controller',
+        );
+        return;
+
+      default:
+        goToTasks(supervisor.supervisor_id, undefined);
+        return;
+    }
+  }
+
   private renderSupervisorTable() {
-    const { goToTasks, filters, onFiltersChange } = this.props;
+    const { filters, onFiltersChange } = this.props;
     const { supervisorsState, statsKey, visibleColumns, page, pageSize, sorted 
} = this.state;
 
     const supervisors = supervisorsState.data || [];
@@ -727,7 +754,7 @@ export class SupervisorsView extends React.PureComponent<
           {
             Header: 'Type',
             accessor: 'type',
-            width: 80,
+            width: 120,
             Cell: this.renderSupervisorFilterableCell('type'),
             show: visibleColumns.shown('Type'),
           },
@@ -741,15 +768,17 @@ export class SupervisorsView extends React.PureComponent<
           {
             Header: 'Status',
             id: 'detailed_state',
-            width: 150,
+            width: 170,
             Filter: suggestibleFilterInput([
               'CONNECTING_TO_STREAM',
               'CREATING_TASKS',
               'DISCOVERING_INITIAL_TASKS',
               'IDLE',
+              'INVALID_SPEC',
               'LOST_CONTACT_WITH_STREAM',
               'PENDING',
               'RUNNING',
+              'SCHEDULER_STOPPED',
               'STOPPING',
               'SUSPENDED',
               'UNABLE_TO_CONNECT_TO_STREAM',
@@ -825,10 +854,11 @@ export class SupervisorsView extends React.PureComponent<
               } else {
                 label = '';
               }
+
               return (
                 <TableClickableCell
                   tooltip="Go to tasks"
-                  onClick={() => goToTasks(original.supervisor_id, 
`index_${original.type}`)}
+                  onClick={() => this.goToTasksForSupervisor(original)}
                   hoverIcon={IconNames.ARROW_TOP_RIGHT}
                 >
                   {label}
@@ -971,14 +1001,11 @@ export class SupervisorsView extends React.PureComponent<
             width: ACTION_COLUMN_WIDTH,
             filterable: false,
             sortable: false,
-            Cell: row => {
-              const id = row.value;
-              const type = row.original.type;
-              const supervisorSuspended = row.original.suspended;
-              const supervisorActions = this.getSupervisorActions(id, 
supervisorSuspended, type);
+            Cell: ({ value: id, original }) => {
+              const supervisorActions = this.getSupervisorActions(original);
               return (
                 <ActionCell
-                  onDetail={() => this.onSupervisorDetail(row.original)}
+                  onDetail={() => this.onSupervisorDetail(original)}
                   actions={supervisorActions}
                   menuTitle={id}
                 />


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to