show execution dialog in task view (#14930)

This commit is contained in:
Vadim Ogievetsky 2023-08-30 15:59:34 -07:00 committed by GitHub
parent 04a1153d0f
commit 680669fd3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 65 additions and 34 deletions

View File

@ -224,16 +224,20 @@ export async function getTaskExecution(
execution = execution.updateWithTaskPayload(taskPayload); 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) { if (execution.status === 'SUCCESS' && !execution.destinationPages) {
const statusResp = await Api.instance.get<AsyncStatusResponse>( try {
`/druid/v2/sql/statements/${encodedId}`, const statusResp = await Api.instance.get<AsyncStatusResponse>(
{ `/druid/v2/sql/statements/${encodedId}`,
cancelToken, {
}, cancelToken,
); },
);
execution = execution.updateWithAsyncStatus(statusResp.data); execution = execution.updateWithAsyncStatus(statusResp.data);
} catch (e) {
if (Api.isNetworkError(e)) throw e;
}
} }
if (execution.hasPotentiallyStuckStage()) { if (execution.hasPotentiallyStuckStage()) {

View File

@ -52,6 +52,7 @@ import {
QueryState, QueryState,
} from '../../utils'; } from '../../utils';
import type { BasicAction } from '../../utils/basic-action'; import type { BasicAction } from '../../utils/basic-action';
import { ExecutionDetailsDialog } from '../workbench-view/execution-details-dialog/execution-details-dialog';
import './tasks-view.scss'; import './tasks-view.scss';
@ -99,9 +100,8 @@ export interface TasksViewState {
taskSpecDialogOpen: boolean; taskSpecDialogOpen: boolean;
alertErrorMsg?: string; alertErrorMsg?: string;
taskTableActionDialogId?: string; taskTableActionDialogOpen?: { id: string; status: string; actions: BasicAction[] };
taskTableActionDialogStatus?: string; executionDialogOpen?: string;
taskTableActionDialogActions: BasicAction[];
visibleColumns: LocalStorageBackedVisibility; visibleColumns: LocalStorageBackedVisibility;
} }
@ -160,8 +160,6 @@ ORDER BY
taskSpecDialogOpen: Boolean(props.openTaskDialog), taskSpecDialogOpen: Boolean(props.openTaskDialog),
taskTableActionDialogActions: [],
visibleColumns: new LocalStorageBackedVisibility( visibleColumns: new LocalStorageBackedVisibility(
LocalStorageKeys.TASK_TABLE_COLUMN_SELECTION, LocalStorageKeys.TASK_TABLE_COLUMN_SELECTION,
), ),
@ -243,10 +241,26 @@ ORDER BY
datasource: string, datasource: string,
status: string, status: string,
type: string, type: string,
fromTable?: boolean,
): BasicAction[] { ): BasicAction[] {
const { goToDatasource, goToClassicBatchDataLoader } = this.props; const { goToDatasource, goToClassicBatchDataLoader } = this.props;
const actions: BasicAction[] = []; 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') { if (datasource && status === 'SUCCESS') {
actions.push({ actions.push({
icon: IconNames.MULTI_SELECT, icon: IconNames.MULTI_SELECT,
@ -317,16 +331,19 @@ ORDER BY
} }
private onTaskDetail(task: TaskQueryResultRow) { private onTaskDetail(task: TaskQueryResultRow) {
this.setState({ if (task.type === 'query_controller') {
taskTableActionDialogId: task.task_id, this.setState({
taskTableActionDialogStatus: task.status, executionDialogOpen: task.task_id,
taskTableActionDialogActions: this.getTaskActions( });
task.task_id, } else {
task.datasource, this.setState({
task.status, taskTableActionDialogOpen: {
task.type, id: task.task_id,
), status: task.status,
}); actions: this.getTaskActions(task.task_id, task.datasource, task.status, task.type),
},
});
}
} }
private renderTaskTable() { private renderTaskTable() {
@ -482,11 +499,10 @@ ORDER BY
const id = row.value; const id = row.value;
const type = row.row.type; const type = row.row.type;
const { datasource, status } = row.original; const { datasource, status } = row.original;
const taskActions = this.getTaskActions(id, datasource, status, type);
return ( return (
<ActionCell <ActionCell
onDetail={() => this.onTaskDetail(row.original)} onDetail={() => this.onTaskDetail(row.original)}
actions={taskActions} actions={this.getTaskActions(id, datasource, status, type, true)}
/> />
); );
}, },
@ -520,13 +536,13 @@ ORDER BY
} }
render() { render() {
const { onFiltersChange } = this.props;
const { const {
groupTasksBy, groupTasksBy,
taskSpecDialogOpen, taskSpecDialogOpen,
executionDialogOpen,
alertErrorMsg, alertErrorMsg,
taskTableActionDialogId, taskTableActionDialogOpen,
taskTableActionDialogActions,
taskTableActionDialogStatus,
visibleColumns, visibleColumns,
} = this.state; } = this.state;
@ -603,12 +619,22 @@ ORDER BY
> >
<p>{alertErrorMsg}</p> <p>{alertErrorMsg}</p>
</AlertDialog> </AlertDialog>
{taskTableActionDialogId && taskTableActionDialogStatus && ( {taskTableActionDialogOpen && (
<TaskTableActionDialog <TaskTableActionDialog
status={taskTableActionDialogStatus} taskId={taskTableActionDialogOpen.id}
taskId={taskTableActionDialogId} status={taskTableActionDialogOpen.status}
actions={taskTableActionDialogActions} actions={taskTableActionDialogOpen.actions}
onClose={() => this.setState({ taskTableActionDialogId: undefined })} 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> </div>

View File

@ -95,6 +95,7 @@ export const ExecutionDetailsPane = React.memo(function ExecutionDetailsPane(
? String(execution.sqlQuery) ? String(execution.sqlQuery)
: JSONBig.stringify(execution.nativeQuery, undefined, 2) : JSONBig.stringify(execution.nativeQuery, undefined, 2)
} }
leaveBackground
/> />
); );

View File

@ -221,7 +221,7 @@ export const ExecutionStagesPane = React.memo(function ExecutionStagesPane(
accessor: d => d.index, accessor: d => d.index,
width: 100, width: 100,
Cell({ value }) { Cell({ value }) {
const taskId = `${execution.id}-worker${value}`; const taskId = `${execution.id}-worker${value}_0`;
return ( return (
<TableClickableCell <TableClickableCell
hoverIcon={IconNames.SHARE} hoverIcon={IconNames.SHARE}