From 5de84253d806e48278c7020b775cdd5f64b2d0f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien?= Date: Tue, 10 Sep 2024 20:34:49 +0200 Subject: [PATCH] Web console query view improvements (#16991) * Made maxNumTaskOptions configurable in the Query view * Updated the copy for taskAssignment options * Reordered options in engine menu for msq engine * fixed snapshot * maxNumTaskOptions -> maxTasksOptions * added back select destination item * fixed duplicate menu item * snapshot * Added the ability to hide certain engine menu options * Added the ability to hide/show more menu items * -> fn * -> fn --- web-console/src/console-application.tsx | 1 - .../max-tasks-button.spec.tsx.snap | 29 +- .../max-tasks-button/max-tasks-button.tsx | 81 +-- .../workbench-view/query-tab/query-tab.tsx | 11 +- .../workbench-view/run-panel/run-panel.tsx | 511 ++++++++++-------- .../views/workbench-view/workbench-view.tsx | 101 ++-- 6 files changed, 429 insertions(+), 305 deletions(-) diff --git a/web-console/src/console-application.tsx b/web-console/src/console-application.tsx index 36a0b8aa392..8a166b932e8 100644 --- a/web-console/src/console-application.tsx +++ b/web-console/src/console-application.tsx @@ -327,7 +327,6 @@ export class ConsoleApplication extends React.PureComponent< baseQueryContext={baseQueryContext} serverQueryContext={serverQueryContext} queryEngines={queryEngines} - allowExplain goToTask={this.goToTasksWithTaskId} getClusterCapacity={maybeGetClusterCapacity} />, diff --git a/web-console/src/views/workbench-view/max-tasks-button/__snapshots__/max-tasks-button.spec.tsx.snap b/web-console/src/views/workbench-view/max-tasks-button/__snapshots__/max-tasks-button.spec.tsx.snap index d4326fdf6dc..89f2fdf4143 100644 --- a/web-console/src/views/workbench-view/max-tasks-button/__snapshots__/max-tasks-button.spec.tsx.snap +++ b/web-console/src/views/workbench-view/max-tasks-button/__snapshots__/max-tasks-button.spec.tsx.snap @@ -100,14 +100,13 @@ exports[`MaxTasksButton matches snapshot 1`] = ` multiline={true} onClick={[Function]} popoverProps={{}} - shouldDismissPopover={false} + shouldDismissPopover={true} text={ Max - : - uses the maximum possible tasks up to the specified limit. + : uses the maximum possible tasks up to the specified limit. } /> @@ -115,24 +114,28 @@ exports[`MaxTasksButton matches snapshot 1`] = ` active={false} disabled={false} icon="blank" - labelElement={ - - } multiline={true} onClick={[Function]} popoverProps={{}} - shouldDismissPopover={false} + shouldDismissPopover={true} text={ Auto - : - maximizes the number of tasks while staying within 512 MiB or 10,000 files per task, unless more tasks are needed to stay under the max task limit. + : uses the minimum number of tasks while + + + staying within constraints. + } /> diff --git a/web-console/src/views/workbench-view/max-tasks-button/max-tasks-button.tsx b/web-console/src/views/workbench-view/max-tasks-button/max-tasks-button.tsx index 21ba60f6b8d..509e943d8b7 100644 --- a/web-console/src/views/workbench-view/max-tasks-button/max-tasks-button.tsx +++ b/web-console/src/views/workbench-view/max-tasks-button/max-tasks-button.tsx @@ -19,34 +19,17 @@ import type { ButtonProps } from '@blueprintjs/core'; import { Button, Menu, MenuDivider, MenuItem, Popover, Position } from '@blueprintjs/core'; import { IconNames } from '@blueprintjs/icons'; -import type { JSX, ReactNode } from 'react'; +import type { JSX } from 'react'; import React, { useState } from 'react'; import { NumericInputDialog } from '../../../dialogs'; -import type { QueryContext, TaskAssignment } from '../../../druid-models'; +import type { QueryContext } from '../../../druid-models'; import { getQueryContextKey } from '../../../druid-models'; import { getLink } from '../../../links'; import { capitalizeFirst, deleteKeys, formatInteger, tickIcon } from '../../../utils'; -const MAX_NUM_TASK_OPTIONS = [2, 3, 4, 5, 7, 9, 11, 17, 33, 65, 129]; -const TASK_ASSIGNMENT_OPTIONS: TaskAssignment[] = ['max', 'auto']; - -const TASK_ASSIGNMENT_DESCRIPTION: Record = { - max: 'uses the maximum possible tasks up to the specified limit.', - auto: 'maximizes the number of tasks while staying within 512 MiB or 10,000 files per task, unless more tasks are needed to stay under the max task limit.', -}; - -const TASK_ASSIGNMENT_LABEL_ELEMENT: Record = { - auto: ( -