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 680669fd3a show execution dialog in task view (#14930)
680669fd3a is described below

commit 680669fd3a72524be71070375a11e6da637a9bec
Author: Vadim Ogievetsky <[email protected]>
AuthorDate: Wed Aug 30 15:59:34 2023 -0700

    show execution dialog in task view (#14930)
---
 .../src/helpers/execution/sql-task-execution.ts    | 20 +++---
 web-console/src/views/tasks-view/tasks-view.tsx    | 76 +++++++++++++++-------
 .../execution-details-pane.tsx                     |  1 +
 .../execution-stages-pane.tsx                      |  2 +-
 4 files changed, 65 insertions(+), 34 deletions(-)

diff --git a/web-console/src/helpers/execution/sql-task-execution.ts 
b/web-console/src/helpers/execution/sql-task-execution.ts
index 1643e8a076..d41370df16 100644
--- a/web-console/src/helpers/execution/sql-task-execution.ts
+++ b/web-console/src/helpers/execution/sql-task-execution.ts
@@ -224,16 +224,20 @@ export async function getTaskExecution(
     execution = execution.updateWithTaskPayload(taskPayload);
   }
 
-  // Still have to pull the destination page info from the async status
+  // Still have to pull the destination page info from the async status, do 
this in a best effort way since the statements API may have permission errors
   if (execution.status === 'SUCCESS' && !execution.destinationPages) {
-    const statusResp = await Api.instance.get<AsyncStatusResponse>(
-      `/druid/v2/sql/statements/${encodedId}`,
-      {
-        cancelToken,
-      },
-    );
+    try {
+      const statusResp = await Api.instance.get<AsyncStatusResponse>(
+        `/druid/v2/sql/statements/${encodedId}`,
+        {
+          cancelToken,
+        },
+      );
 
-    execution = execution.updateWithAsyncStatus(statusResp.data);
+      execution = execution.updateWithAsyncStatus(statusResp.data);
+    } catch (e) {
+      if (Api.isNetworkError(e)) throw e;
+    }
   }
 
   if (execution.hasPotentiallyStuckStage()) {
diff --git a/web-console/src/views/tasks-view/tasks-view.tsx 
b/web-console/src/views/tasks-view/tasks-view.tsx
index b9208cbed0..795c990841 100644
--- a/web-console/src/views/tasks-view/tasks-view.tsx
+++ b/web-console/src/views/tasks-view/tasks-view.tsx
@@ -52,6 +52,7 @@ import {
   QueryState,
 } from '../../utils';
 import type { BasicAction } from '../../utils/basic-action';
+import { ExecutionDetailsDialog } from 
'../workbench-view/execution-details-dialog/execution-details-dialog';
 
 import './tasks-view.scss';
 
@@ -99,9 +100,8 @@ export interface TasksViewState {
   taskSpecDialogOpen: boolean;
   alertErrorMsg?: string;
 
-  taskTableActionDialogId?: string;
-  taskTableActionDialogStatus?: string;
-  taskTableActionDialogActions: BasicAction[];
+  taskTableActionDialogOpen?: { id: string; status: string; actions: 
BasicAction[] };
+  executionDialogOpen?: string;
   visibleColumns: LocalStorageBackedVisibility;
 }
 
@@ -160,8 +160,6 @@ ORDER BY
 
       taskSpecDialogOpen: Boolean(props.openTaskDialog),
 
-      taskTableActionDialogActions: [],
-
       visibleColumns: new LocalStorageBackedVisibility(
         LocalStorageKeys.TASK_TABLE_COLUMN_SELECTION,
       ),
@@ -243,10 +241,26 @@ ORDER BY
     datasource: string,
     status: string,
     type: string,
+    fromTable?: boolean,
   ): BasicAction[] {
     const { goToDatasource, goToClassicBatchDataLoader } = this.props;
 
     const actions: BasicAction[] = [];
+    if (fromTable) {
+      actions.push({
+        icon: IconNames.SEARCH_TEMPLATE,
+        title: 'View raw details',
+        onAction: () => {
+          this.setState({
+            taskTableActionDialogOpen: {
+              id,
+              status,
+              actions: this.getTaskActions(id, datasource, status, type),
+            },
+          });
+        },
+      });
+    }
     if (datasource && status === 'SUCCESS') {
       actions.push({
         icon: IconNames.MULTI_SELECT,
@@ -317,16 +331,19 @@ ORDER BY
   }
 
   private onTaskDetail(task: TaskQueryResultRow) {
-    this.setState({
-      taskTableActionDialogId: task.task_id,
-      taskTableActionDialogStatus: task.status,
-      taskTableActionDialogActions: this.getTaskActions(
-        task.task_id,
-        task.datasource,
-        task.status,
-        task.type,
-      ),
-    });
+    if (task.type === 'query_controller') {
+      this.setState({
+        executionDialogOpen: task.task_id,
+      });
+    } else {
+      this.setState({
+        taskTableActionDialogOpen: {
+          id: task.task_id,
+          status: task.status,
+          actions: this.getTaskActions(task.task_id, task.datasource, 
task.status, task.type),
+        },
+      });
+    }
   }
 
   private renderTaskTable() {
@@ -482,11 +499,10 @@ ORDER BY
               const id = row.value;
               const type = row.row.type;
               const { datasource, status } = row.original;
-              const taskActions = this.getTaskActions(id, datasource, status, 
type);
               return (
                 <ActionCell
                   onDetail={() => this.onTaskDetail(row.original)}
-                  actions={taskActions}
+                  actions={this.getTaskActions(id, datasource, status, type, 
true)}
                 />
               );
             },
@@ -520,13 +536,13 @@ ORDER BY
   }
 
   render() {
+    const { onFiltersChange } = this.props;
     const {
       groupTasksBy,
       taskSpecDialogOpen,
+      executionDialogOpen,
       alertErrorMsg,
-      taskTableActionDialogId,
-      taskTableActionDialogActions,
-      taskTableActionDialogStatus,
+      taskTableActionDialogOpen,
       visibleColumns,
     } = this.state;
 
@@ -603,12 +619,22 @@ ORDER BY
         >
           <p>{alertErrorMsg}</p>
         </AlertDialog>
-        {taskTableActionDialogId && taskTableActionDialogStatus && (
+        {taskTableActionDialogOpen && (
           <TaskTableActionDialog
-            status={taskTableActionDialogStatus}
-            taskId={taskTableActionDialogId}
-            actions={taskTableActionDialogActions}
-            onClose={() => this.setState({ taskTableActionDialogId: undefined 
})}
+            taskId={taskTableActionDialogOpen.id}
+            status={taskTableActionDialogOpen.status}
+            actions={taskTableActionDialogOpen.actions}
+            onClose={() => this.setState({ taskTableActionDialogOpen: 
undefined })}
+          />
+        )}
+        {executionDialogOpen && (
+          <ExecutionDetailsDialog
+            id={executionDialogOpen}
+            goToTask={taskId => {
+              onFiltersChange([{ id: 'task_id', value: `=${taskId}` }]);
+              this.setState({ executionDialogOpen: undefined });
+            }}
+            onClose={() => this.setState({ executionDialogOpen: undefined })}
           />
         )}
       </div>
diff --git 
a/web-console/src/views/workbench-view/execution-details-pane/execution-details-pane.tsx
 
b/web-console/src/views/workbench-view/execution-details-pane/execution-details-pane.tsx
index e448fd8a50..72a6350d7b 100644
--- 
a/web-console/src/views/workbench-view/execution-details-pane/execution-details-pane.tsx
+++ 
b/web-console/src/views/workbench-view/execution-details-pane/execution-details-pane.tsx
@@ -95,6 +95,7 @@ export const ExecutionDetailsPane = React.memo(function 
ExecutionDetailsPane(
                 ? String(execution.sqlQuery)
                 : JSONBig.stringify(execution.nativeQuery, undefined, 2)
             }
+            leaveBackground
           />
         );
 
diff --git 
a/web-console/src/views/workbench-view/execution-stages-pane/execution-stages-pane.tsx
 
b/web-console/src/views/workbench-view/execution-stages-pane/execution-stages-pane.tsx
index 57827534df..1c06446eb1 100644
--- 
a/web-console/src/views/workbench-view/execution-stages-pane/execution-stages-pane.tsx
+++ 
b/web-console/src/views/workbench-view/execution-stages-pane/execution-stages-pane.tsx
@@ -221,7 +221,7 @@ export const ExecutionStagesPane = React.memo(function 
ExecutionStagesPane(
             accessor: d => d.index,
             width: 100,
             Cell({ value }) {
-              const taskId = `${execution.id}-worker${value}`;
+              const taskId = `${execution.id}-worker${value}_0`;
               return (
                 <TableClickableCell
                   hoverIcon={IconNames.SHARE}


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

Reply via email to