From 655ad1e2c15cd8bc91bb2b09daa2fc5d067b00fe Mon Sep 17 00:00:00 2001 From: Vadim Ogievetsky Date: Sat, 1 Oct 2022 20:21:39 -0700 Subject: [PATCH 01/10] remove old query view --- .../src/components/header-bar/header-bar.tsx | 8 +- .../record-table-pane/record-table-pane.tsx | 2 +- web-console/src/console-application.tsx | 21 +- web-console/src/utils/local-storage-keys.tsx | 1 - web-console/src/views/index.ts | 1 - .../__snapshots__/query-view.spec.tsx.snap | 163 -- .../live-query-mode-button.spec.tsx.snap | 153 -- .../live-query-mode-button.scss | 40 - .../live-query-mode-button.spec.tsx | 48 - .../live-query-mode-button.tsx | 80 - .../query-extra-info.spec.tsx.snap | 51 - .../query-extra-info/query-extra-info.scss | 29 - .../query-extra-info.spec.tsx | 40 - .../query-extra-info/query-extra-info.tsx | 108 -- .../query-history-dialog.spec.tsx.snap | 98 -- .../query-history-dialog.scss | 39 - .../query-history-dialog.spec.tsx | 32 - .../query-history-dialog.tsx | 88 - .../__snapshots__/query-input.spec.tsx.snap | 111 -- .../query-view/query-input/query-input.scss | 27 - .../query-input/query-input.spec.tsx | 43 - .../query-view/query-input/query-input.tsx | 279 ---- .../__snapshots__/query-output.spec.tsx.snap | 1461 ----------------- .../column-rename-input.spec.tsx.snap | 13 - .../column-rename-input.spec.tsx | 30 - .../column-rename-input.tsx | 62 - .../query-view/query-output/query-output.scss | 76 - .../query-output/query-output.spec.tsx | 61 - .../query-view/query-output/query-output.tsx | 422 ----- .../__snapshots__/query-timer.spec.tsx.snap | 32 - .../query-view/query-timer/query-timer.scss | 23 - .../query-timer/query-timer.spec.tsx | 42 - .../query-view/query-timer/query-timer.tsx | 48 - .../src/views/query-view/query-view.scss | 125 -- .../src/views/query-view/query-view.spec.tsx | 34 - .../src/views/query-view/query-view.tsx | 617 ------- .../__snapshots__/run-button.spec.tsx.snap | 129 -- .../query-view/run-button/run-button.scss | 23 - .../query-view/run-button/run-button.spec.tsx | 62 - .../query-view/run-button/run-button.tsx | 196 --- .../preview-table/preview-table.tsx | 2 +- .../__snapshots__/column-tree.spec.tsx.snap | 0 .../column-tree/column-tree-menu/index.ts | 0 .../number-menu-items.spec.tsx.snap | 0 .../number-menu-items.spec.tsx | 0 .../number-menu-items/number-menu-items.tsx | 0 .../string-menu-items.spec.tsx.snap | 0 .../string-menu-items.spec.tsx | 0 .../string-menu-items/string-menu-items.tsx | 0 .../time-menu-items.spec.tsx.snap | 0 .../time-menu-items/time-menu-items.spec.tsx | 0 .../time-menu-items/time-menu-items.tsx | 0 .../column-tree/column-tree.scss | 0 .../column-tree/column-tree.spec.tsx | 0 .../column-tree/column-tree.tsx | 0 .../explain-dialog.spec.tsx.snap | 0 .../explain-dialog/explain-dialog.scss | 2 +- .../explain-dialog/explain-dialog.spec.tsx | 0 .../explain-dialog/explain-dialog.tsx | 0 .../result-table-pane/result-table-pane.tsx | 2 +- .../views/workbench-view/workbench-view.tsx | 4 +- 61 files changed, 11 insertions(+), 4917 deletions(-) delete mode 100644 web-console/src/views/query-view/__snapshots__/query-view.spec.tsx.snap delete mode 100644 web-console/src/views/query-view/live-query-mode-button/__snapshots__/live-query-mode-button.spec.tsx.snap delete mode 100644 web-console/src/views/query-view/live-query-mode-button/live-query-mode-button.scss delete mode 100644 web-console/src/views/query-view/live-query-mode-button/live-query-mode-button.spec.tsx delete mode 100644 web-console/src/views/query-view/live-query-mode-button/live-query-mode-button.tsx delete mode 100644 web-console/src/views/query-view/query-extra-info/__snapshots__/query-extra-info.spec.tsx.snap delete mode 100644 web-console/src/views/query-view/query-extra-info/query-extra-info.scss delete mode 100644 web-console/src/views/query-view/query-extra-info/query-extra-info.spec.tsx delete mode 100644 web-console/src/views/query-view/query-extra-info/query-extra-info.tsx delete mode 100644 web-console/src/views/query-view/query-history-dialog/__snapshots__/query-history-dialog.spec.tsx.snap delete mode 100644 web-console/src/views/query-view/query-history-dialog/query-history-dialog.scss delete mode 100644 web-console/src/views/query-view/query-history-dialog/query-history-dialog.spec.tsx delete mode 100644 web-console/src/views/query-view/query-history-dialog/query-history-dialog.tsx delete mode 100644 web-console/src/views/query-view/query-input/__snapshots__/query-input.spec.tsx.snap delete mode 100644 web-console/src/views/query-view/query-input/query-input.scss delete mode 100644 web-console/src/views/query-view/query-input/query-input.spec.tsx delete mode 100644 web-console/src/views/query-view/query-input/query-input.tsx delete mode 100644 web-console/src/views/query-view/query-output/__snapshots__/query-output.spec.tsx.snap delete mode 100644 web-console/src/views/query-view/query-output/column-rename-input/__snapshots__/column-rename-input.spec.tsx.snap delete mode 100644 web-console/src/views/query-view/query-output/column-rename-input/column-rename-input.spec.tsx delete mode 100644 web-console/src/views/query-view/query-output/column-rename-input/column-rename-input.tsx delete mode 100644 web-console/src/views/query-view/query-output/query-output.scss delete mode 100644 web-console/src/views/query-view/query-output/query-output.spec.tsx delete mode 100644 web-console/src/views/query-view/query-output/query-output.tsx delete mode 100644 web-console/src/views/query-view/query-timer/__snapshots__/query-timer.spec.tsx.snap delete mode 100644 web-console/src/views/query-view/query-timer/query-timer.scss delete mode 100644 web-console/src/views/query-view/query-timer/query-timer.spec.tsx delete mode 100644 web-console/src/views/query-view/query-timer/query-timer.tsx delete mode 100644 web-console/src/views/query-view/query-view.scss delete mode 100644 web-console/src/views/query-view/query-view.spec.tsx delete mode 100644 web-console/src/views/query-view/query-view.tsx delete mode 100644 web-console/src/views/query-view/run-button/__snapshots__/run-button.spec.tsx.snap delete mode 100644 web-console/src/views/query-view/run-button/run-button.scss delete mode 100644 web-console/src/views/query-view/run-button/run-button.spec.tsx delete mode 100644 web-console/src/views/query-view/run-button/run-button.tsx rename web-console/src/views/{query-view => workbench-view}/column-tree/__snapshots__/column-tree.spec.tsx.snap (100%) rename web-console/src/views/{query-view => workbench-view}/column-tree/column-tree-menu/index.ts (100%) rename web-console/src/views/{query-view => workbench-view}/column-tree/column-tree-menu/number-menu-items/__snapshots__/number-menu-items.spec.tsx.snap (100%) rename web-console/src/views/{query-view => workbench-view}/column-tree/column-tree-menu/number-menu-items/number-menu-items.spec.tsx (100%) rename web-console/src/views/{query-view => workbench-view}/column-tree/column-tree-menu/number-menu-items/number-menu-items.tsx (100%) rename web-console/src/views/{query-view => workbench-view}/column-tree/column-tree-menu/string-menu-items/__snapshots__/string-menu-items.spec.tsx.snap (100%) rename web-console/src/views/{query-view => workbench-view}/column-tree/column-tree-menu/string-menu-items/string-menu-items.spec.tsx (100%) rename web-console/src/views/{query-view => workbench-view}/column-tree/column-tree-menu/string-menu-items/string-menu-items.tsx (100%) rename web-console/src/views/{query-view => workbench-view}/column-tree/column-tree-menu/time-menu-items/__snapshots__/time-menu-items.spec.tsx.snap (100%) rename web-console/src/views/{query-view => workbench-view}/column-tree/column-tree-menu/time-menu-items/time-menu-items.spec.tsx (100%) rename web-console/src/views/{query-view => workbench-view}/column-tree/column-tree-menu/time-menu-items/time-menu-items.tsx (100%) rename web-console/src/views/{query-view => workbench-view}/column-tree/column-tree.scss (100%) rename web-console/src/views/{query-view => workbench-view}/column-tree/column-tree.spec.tsx (100%) rename web-console/src/views/{query-view => workbench-view}/column-tree/column-tree.tsx (100%) rename web-console/src/views/{query-view => workbench-view}/explain-dialog/__snapshots__/explain-dialog.spec.tsx.snap (100%) rename web-console/src/views/{query-view => workbench-view}/explain-dialog/explain-dialog.scss (98%) rename web-console/src/views/{query-view => workbench-view}/explain-dialog/explain-dialog.spec.tsx (100%) rename web-console/src/views/{query-view => workbench-view}/explain-dialog/explain-dialog.tsx (100%) diff --git a/web-console/src/components/header-bar/header-bar.tsx b/web-console/src/components/header-bar/header-bar.tsx index 4f4c9ff922c9..d7d2b1526306 100644 --- a/web-console/src/components/header-bar/header-bar.tsx +++ b/web-console/src/components/header-bar/header-bar.tsx @@ -65,7 +65,6 @@ export type HeaderActiveTab = | 'datasources' | 'segments' | 'services' - | 'query' | 'workbench' | 'sql-data-loader' | 'lookups'; @@ -388,16 +387,11 @@ export const HeaderBar = React.memo(function HeaderBar(props: HeaderBarProps) { { - if (!e.altKey) return; - e.preventDefault(); - location.hash = '#query'; - }} /> {showSplitDataLoaderMenu ? ( '; return ( - {ex && val && !jsonColumn && ( + {ex?.getFirstColumn() && val && !jsonColumn && ( <> {filterOnMenuItem(IconNames.FILTER, ex.equal(val))} {filterOnMenuItem(IconNames.FILTER, ex.unequal(val))} diff --git a/web-console/src/console-application.tsx b/web-console/src/console-application.tsx index d5dc61cebc9f..02845835dd1b 100644 --- a/web-console/src/console-application.tsx +++ b/web-console/src/console-application.tsx @@ -20,7 +20,7 @@ import { HotkeysProvider, Intent } from '@blueprintjs/core'; import { IconNames } from '@blueprintjs/icons'; import classNames from 'classnames'; import React from 'react'; -import { RouteComponentProps } from 'react-router'; +import { Redirect, RouteComponentProps } from 'react-router'; import { HashRouter, Route, Switch } from 'react-router-dom'; import { HeaderActiveTab, HeaderBar, Loader } from './components'; @@ -33,7 +33,6 @@ import { IngestionView, LoadDataView, LookupsView, - QueryView, SegmentsView, ServicesView, SqlDataLoaderView, @@ -245,20 +244,6 @@ export class ConsoleApplication extends React.PureComponent< ); }; - private readonly wrappedQueryView = () => { - const { defaultQueryContext, mandatoryQueryContext } = this.props; - - return this.wrapInViewContainer( - 'query', - , - 'thin', - ); - }; - private readonly wrappedWorkbenchView = (p: RouteComponentProps) => { const { defaultQueryContext, mandatoryQueryContext } = this.props; const { capabilities } = this.state; @@ -384,7 +369,9 @@ export class ConsoleApplication extends React.PureComponent< - + + + - = CURRENT_TIMESTAMP - INTERVAL '1' DAY"} - getParsedQuery={[Function]} - onQueryChange={[Function]} - /> - -
- -
- - - - - - -
-
-
- -
-
- -`; - -exports[`QueryView matches snapshot with query 1`] = ` -
- = CURRENT_TIMESTAMP - INTERVAL '1' DAY"} - getParsedQuery={[Function]} - onQueryChange={[Function]} - /> - -
- -
- - - - - - -
-
-
- -
-
-
-`; diff --git a/web-console/src/views/query-view/live-query-mode-button/__snapshots__/live-query-mode-button.spec.tsx.snap b/web-console/src/views/query-view/live-query-mode-button/__snapshots__/live-query-mode-button.spec.tsx.snap deleted file mode 100644 index dab20a797f6a..000000000000 --- a/web-console/src/views/query-view/live-query-mode-button/__snapshots__/live-query-mode-button.spec.tsx.snap +++ /dev/null @@ -1,153 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`LiveQueryModeButton matches snapshot auto 1`] = ` - - - - - - } - defaultIsOpen={false} - disabled={false} - fill={false} - hasBackdrop={false} - hoverCloseDelay={300} - hoverOpenDelay={150} - inheritDarkTheme={true} - interactionKind="click" - minimal={false} - openOnTargetFocus={true} - portalClassName="live-query-mode-button-portal" - position="bottom-left" - positioningStrategy="absolute" - shouldReturnFocusOnClose={false} - targetTagName="span" - transitionDuration={300} - usePortal={true} -> - - Live query: - - - Auto - - - -`; - -exports[`LiveQueryModeButton matches snapshot on 1`] = ` - - - - - - } - defaultIsOpen={false} - disabled={false} - fill={false} - hasBackdrop={false} - hoverCloseDelay={300} - hoverOpenDelay={150} - inheritDarkTheme={true} - interactionKind="click" - minimal={false} - openOnTargetFocus={true} - portalClassName="live-query-mode-button-portal" - position="bottom-left" - positioningStrategy="absolute" - shouldReturnFocusOnClose={false} - targetTagName="span" - transitionDuration={300} - usePortal={true} -> - - Live query: - - - On - - - -`; diff --git a/web-console/src/views/query-view/live-query-mode-button/live-query-mode-button.scss b/web-console/src/views/query-view/live-query-mode-button/live-query-mode-button.scss deleted file mode 100644 index b6c257a20ee3..000000000000 --- a/web-console/src/views/query-view/live-query-mode-button/live-query-mode-button.scss +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -@import '../../../variables'; -@import '../../../blueprint-overrides/common/colors'; - -.live-query-mode-button { - .auto.auto-on { - color: $druid-brand; - } - - .on { - color: $druid-brand; - } -} - -.live-query-mode-button-portal { - .auto.auto-on .#{$bp-ns}-text-overflow-ellipsis { - color: $druid-brand; - } - - .on .#{$bp-ns}-text-overflow-ellipsis { - color: $druid-brand; - } -} diff --git a/web-console/src/views/query-view/live-query-mode-button/live-query-mode-button.spec.tsx b/web-console/src/views/query-view/live-query-mode-button/live-query-mode-button.spec.tsx deleted file mode 100644 index f49a5caaa5f3..000000000000 --- a/web-console/src/views/query-view/live-query-mode-button/live-query-mode-button.spec.tsx +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { shallow } from 'enzyme'; -import React from 'react'; - -import { LiveQueryModeButton } from './live-query-mode-button'; - -describe('LiveQueryModeButton', () => { - it('matches snapshot on', () => { - const liveQueryModeSelector = shallow( - {}} - autoLiveQueryModeShouldRun - />, - ); - - expect(liveQueryModeSelector).toMatchSnapshot(); - }); - - it('matches snapshot auto', () => { - const liveQueryModeSelector = shallow( - {}} - autoLiveQueryModeShouldRun - />, - ); - - expect(liveQueryModeSelector).toMatchSnapshot(); - }); -}); diff --git a/web-console/src/views/query-view/live-query-mode-button/live-query-mode-button.tsx b/web-console/src/views/query-view/live-query-mode-button/live-query-mode-button.tsx deleted file mode 100644 index cae6f3a62de1..000000000000 --- a/web-console/src/views/query-view/live-query-mode-button/live-query-mode-button.tsx +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Button, Menu, MenuItem, PopoverPosition } from '@blueprintjs/core'; -import { Popover2 } from '@blueprintjs/popover2'; -import classNames from 'classnames'; -import React from 'react'; - -import { tickIcon } from '../../../utils'; - -import './live-query-mode-button.scss'; - -export type LiveQueryMode = 'auto' | 'on' | 'off'; -export const LIVE_QUERY_MODES: LiveQueryMode[] = ['auto', 'on', 'off']; -export const LIVE_QUERY_MODE_TITLE: Record = { - auto: 'Auto', - on: 'On', - off: 'Off', -}; - -export interface LiveQueryModeButtonProps { - liveQueryMode: LiveQueryMode; - onLiveQueryModeChange(liveQueryMode: LiveQueryMode): void; - autoLiveQueryModeShouldRun: boolean; - minimal?: boolean; -} - -export const LiveQueryModeButton = React.memo(function LiveQueryModeButton( - props: LiveQueryModeButtonProps, -) { - const { liveQueryMode, onLiveQueryModeChange, autoLiveQueryModeShouldRun, minimal } = props; - - return ( - - {LIVE_QUERY_MODES.map(m => ( - onLiveQueryModeChange(m)} - /> - ))} -
- } - > - -
- ); -}); diff --git a/web-console/src/views/query-view/query-extra-info/__snapshots__/query-extra-info.spec.tsx.snap b/web-console/src/views/query-view/query-extra-info/__snapshots__/query-extra-info.spec.tsx.snap deleted file mode 100644 index 0c0bb065ee03..000000000000 --- a/web-console/src/views/query-view/query-extra-info/__snapshots__/query-extra-info.spec.tsx.snap +++ /dev/null @@ -1,51 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`QueryExtraInfo matches snapshot 1`] = ` -
-
- - - 0 results in 8.00s - - -
- - - -
-`; diff --git a/web-console/src/views/query-view/query-extra-info/query-extra-info.scss b/web-console/src/views/query-view/query-extra-info/query-extra-info.scss deleted file mode 100644 index 3b16a5d8e7df..000000000000 --- a/web-console/src/views/query-view/query-extra-info/query-extra-info.scss +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -.query-extra-info { - & > * { - display: inline-block; - } - - .query-info { - line-height: 30px; - white-space: nowrap; - cursor: pointer; - } -} diff --git a/web-console/src/views/query-view/query-extra-info/query-extra-info.spec.tsx b/web-console/src/views/query-view/query-extra-info/query-extra-info.spec.tsx deleted file mode 100644 index 118c9cf5b782..000000000000 --- a/web-console/src/views/query-view/query-extra-info/query-extra-info.spec.tsx +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { render } from '@testing-library/react'; -import { QueryResult } from 'druid-query-toolkit'; -import React from 'react'; - -import { QueryExtraInfo } from './query-extra-info'; - -describe('QueryExtraInfo', () => { - it('matches snapshot', () => { - const queryExtraInfo = ( - {}} - onLoadMore={() => {}} - /> - ); - - const { container } = render(queryExtraInfo); - expect(container.firstChild).toMatchSnapshot(); - }); -}); diff --git a/web-console/src/views/query-view/query-extra-info/query-extra-info.tsx b/web-console/src/views/query-view/query-extra-info/query-extra-info.tsx deleted file mode 100644 index ce3996685b15..000000000000 --- a/web-console/src/views/query-view/query-extra-info/query-extra-info.tsx +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Button, Intent, Menu, MenuDivider, MenuItem, Position } from '@blueprintjs/core'; -import { IconNames } from '@blueprintjs/icons'; -import { Popover2, Tooltip2 } from '@blueprintjs/popover2'; -import copy from 'copy-to-clipboard'; -import { QueryResult } from 'druid-query-toolkit'; -import React, { MouseEvent } from 'react'; - -import { AppToaster } from '../../../singletons'; -import { pluralIfNeeded } from '../../../utils'; - -import './query-extra-info.scss'; - -export interface QueryExtraInfoProps { - queryResult: QueryResult; - onDownload: (filename: string, format: string) => void; - onLoadMore: () => void; -} - -export const QueryExtraInfo = React.memo(function QueryExtraInfo(props: QueryExtraInfoProps) { - const { queryResult, onDownload, onLoadMore } = props; - const wrapQueryLimit = queryResult.getSqlOuterLimit(); - const hasMoreResults = queryResult.getNumResults() === wrapQueryLimit; - - function handleQueryInfoClick(e: MouseEvent) { - if (e.altKey) { - if (hasMoreResults) { - onLoadMore(); - } - } else { - const id = queryResult.queryId || queryResult.sqlQueryId; - if (!id) return; - - copy(id, { format: 'text/plain' }); - AppToaster.show({ - message: 'Query ID copied to clipboard', - intent: Intent.SUCCESS, - }); - } - } - - function handleDownload(format: string) { - const id = queryResult.queryId || queryResult.sqlQueryId; - if (!id) return; - - onDownload(`query-${id}.${format}`, format); - } - - const downloadMenu = ( - - - handleDownload('csv')} /> - handleDownload('tsv')} /> - handleDownload('json')} /> - - ); - - const resultCount = hasMoreResults - ? `${queryResult.getNumResults() - 1}+ results` - : pluralIfNeeded(queryResult.getNumResults(), 'result'); - - let tooltipContent: JSX.Element | undefined; - if (queryResult.queryId) { - tooltipContent = ( - <> - Query ID: {queryResult.queryId} (click to copy) - - ); - } else if (queryResult.sqlQueryId) { - tooltipContent = ( - <> - SQL query ID: {queryResult.sqlQueryId} (click to copy) - - ); - } - - return ( -
- {typeof queryResult.queryDuration !== 'undefined' && ( -
- - {`${resultCount} in ${(queryResult.queryDuration / 1000).toFixed(2)}s`} - -
- )} - -
- ); -}); diff --git a/web-console/src/views/query-view/query-history-dialog/__snapshots__/query-history-dialog.spec.tsx.snap b/web-console/src/views/query-view/query-history-dialog/__snapshots__/query-history-dialog.spec.tsx.snap deleted file mode 100644 index a833c85c1a50..000000000000 --- a/web-console/src/views/query-view/query-history-dialog/__snapshots__/query-history-dialog.spec.tsx.snap +++ /dev/null @@ -1,98 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`QueryHistoryDialog matches snapshot 1`] = ` -
-
-
-
-
- -
-
-
-
-`; diff --git a/web-console/src/views/query-view/query-history-dialog/query-history-dialog.scss b/web-console/src/views/query-view/query-history-dialog/query-history-dialog.scss deleted file mode 100644 index b18f74f8fdbf..000000000000 --- a/web-console/src/views/query-view/query-history-dialog/query-history-dialog.scss +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -@import '../../../variables'; - -.query-history-dialog { - &.#{$bp-ns}-dialog { - width: 900px; - } - - .panel { - width: 100%; - } - - .text-area { - width: 100%; - height: 500px; - resize: none; - } - - .center-message { - height: 400px; - } -} diff --git a/web-console/src/views/query-view/query-history-dialog/query-history-dialog.spec.tsx b/web-console/src/views/query-view/query-history-dialog/query-history-dialog.spec.tsx deleted file mode 100644 index e5cd42d74d1b..000000000000 --- a/web-console/src/views/query-view/query-history-dialog/query-history-dialog.spec.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { render } from '@testing-library/react'; -import React from 'react'; - -import { QueryHistoryDialog } from './query-history-dialog'; - -describe('QueryHistoryDialog', () => { - it('matches snapshot', () => { - const queryPlanDialog = ( - null} queryRecords={[]} onClose={() => {}} /> - ); - render(queryPlanDialog); - expect(document.body.lastChild).toMatchSnapshot(); - }); -}); diff --git a/web-console/src/views/query-view/query-history-dialog/query-history-dialog.tsx b/web-console/src/views/query-view/query-history-dialog/query-history-dialog.tsx deleted file mode 100644 index df7dbc8a080c..000000000000 --- a/web-console/src/views/query-view/query-history-dialog/query-history-dialog.tsx +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Button, Classes, Dialog, Intent, Tab, Tabs, TextArea } from '@blueprintjs/core'; -import React, { useState } from 'react'; - -import { CenterMessage } from '../../../components'; -import { QueryRecord } from '../../../utils/query-history'; - -import './query-history-dialog.scss'; - -export interface QueryHistoryDialogProps { - queryRecords: readonly QueryRecord[]; - setQueryString: (queryString: string, queryContext: Record) => void; - onClose: () => void; -} - -export const QueryHistoryDialog = React.memo(function QueryHistoryDialog( - props: QueryHistoryDialogProps, -) { - const [activeTab, setActiveTab] = useState(0); - const { queryRecords, setQueryString, onClose } = props; - - function handleSelect() { - const queryRecord = queryRecords[activeTab]; - setQueryString(queryRecord.queryString, queryRecord.queryContext || {}); - onClose(); - } - - function renderContent(): JSX.Element { - if (!queryRecords.length) { - return The query history is empty.; - } - - const versions = queryRecords.map((record, index) => ( - } - panelClassName="panel" - /> - )); - - return ( - setActiveTab(t)} - > - {versions} - - - ); - } - - return ( - -
{renderContent()}
-
-
-
-
-
- ); -}); diff --git a/web-console/src/views/query-view/query-input/__snapshots__/query-input.spec.tsx.snap b/web-console/src/views/query-view/query-input/__snapshots__/query-input.spec.tsx.snap deleted file mode 100644 index d67f1bbcc81a..000000000000 --- a/web-console/src/views/query-view/query-input/__snapshots__/query-input.spec.tsx.snap +++ /dev/null @@ -1,111 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`QueryInput correctly formats helper HTML 1`] = ` -" -
COUNT
-
COUNT(*)
-
Counts the number of things
" -`; - -exports[`QueryInput matches snapshot 1`] = ` -
-
-
-