From 1263c818186d1e0ba23b6003f5f91af58e25b364 Mon Sep 17 00:00:00 2001 From: Paul Sebastian Date: Sun, 5 Nov 2023 17:57:36 -0800 Subject: [PATCH] implement query area section w/ assistant bar and w/out functionality Signed-off-by: Paul Sebastian --- .../common/live_tail/live_tail_button.tsx | 12 +- .../components/common/search/query_area.tsx | 77 +++++ public/components/common/search/search.tsx | 280 +++++++++--------- 3 files changed, 228 insertions(+), 141 deletions(-) create mode 100644 public/components/common/search/query_area.tsx diff --git a/public/components/common/live_tail/live_tail_button.tsx b/public/components/common/live_tail/live_tail_button.tsx index 0e53152fa..66bb91591 100644 --- a/public/components/common/live_tail/live_tail_button.tsx +++ b/public/components/common/live_tail/live_tail_button.tsx @@ -3,13 +3,13 @@ * SPDX-License-Identifier: Apache-2.0 */ -//Define pop over interval options for live tail button in your plugin +// Define pop over interval options for live tail button in your plugin -import { EuiButton } from "@elastic/eui"; -import React, { useMemo } from "react"; -import { LiveTailProps } from "common/types/explorer"; +import { EuiButton } from '@elastic/eui'; +import React, { useMemo } from 'react'; +import { LiveTailProps } from 'common/types/explorer'; -//Live Tail Button +// Live Tail Button export const LiveTailButton = ({ isLiveTailOn, isLiveTailPopoverOpen, @@ -20,7 +20,7 @@ export const LiveTailButton = ({ const liveButton = useMemo(() => { return ( setIsLiveTailPopoverOpen(!isLiveTailPopoverOpen)} data-test-subj={dataTestSubj} diff --git a/public/components/common/search/query_area.tsx b/public/components/common/search/query_area.tsx new file mode 100644 index 000000000..d72be0021 --- /dev/null +++ b/public/components/common/search/query_area.tsx @@ -0,0 +1,77 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import { + EuiButton, + EuiCodeEditor, + EuiContextMenuPanel, + EuiFieldText, + EuiFlexGroup, + EuiFlexItem, + EuiIcon, + EuiPanel, + EuiPopover, +} from '@elastic/eui'; +import React from 'react'; + +export function QueryArea({ + languagePopOverButton, + isLanguagePopoverOpen, + closeLanguagePopover, + languagePopOverItems, +}: any) { + return ( + + + + + + + + + + + index name here + + + + + + + + + + + + + + + + + Go + + + + + + + ); +} diff --git a/public/components/common/search/search.tsx b/public/components/common/search/search.tsx index de450d09c..52eaed7f8 100644 --- a/public/components/common/search/search.tsx +++ b/public/components/common/search/search.tsx @@ -35,6 +35,7 @@ import { LiveTailButton, StopLiveButton } from '../live_tail/live_tail_button'; import { Autocomplete } from './autocomplete'; import { DatePicker } from './date_picker'; import { QUERY_LANGUAGE } from '../../../../common/constants/data_sources'; +import { QueryArea } from './query_area'; export interface IQueryBarProps { query: string; tempQuery: string; @@ -217,145 +218,154 @@ export const Search = (props: any) => { return (
- - {appLogEvents && ( - - - - Base Query - - - - )} - {!appLogEvents && ( - - - - - - )} - - { - onQuerySearch(queryLang); - }} - dslService={dslService} - getSuggestions={getSuggestions} - onItemSelect={onItemSelect} - tabId={tabId} - /> - showFlyout()} - onClickAriaLabel={'pplLinkShowFlyout'} - > - PPL - - - - - {!isLiveTailOn && ( - handleTimePickerChange(timeRange)} - handleTimeRangePickerRefresh={() => { - onQuerySearch(queryLang); - }} - /> - )} - - {showSaveButton && !showSavePanelOptionsList && ( - - - - - - )} - {isLiveTailOn && ( - - - - )} - {showSaveButton && searchBarConfigs[selectedSubTabId]?.showSaveButton && ( - <> - - setIsSavePanelOpen(false)} + + + + {appLogEvents && ( + + + + Base Query + + + + )} + {appLogEvents && ( + - { + onQuerySearch(queryLang); + }} + dslService={dslService} + getSuggestions={getSuggestions} + onItemSelect={onItemSelect} + tabId={tabId} + /> + showFlyout()} + onClickAriaLabel={'pplLinkShowFlyout'} + > + PPL + + + )} + + + {!isLiveTailOn && ( + + handleTimePickerChange(timeRange) } + handleTimeRangePickerRefresh={() => { + onQuerySearch(queryLang); + }} /> - - - - setIsSavePanelOpen(false)} - data-test-subj="eventExplorer__querySaveCancel" - > - Cancel - - - - { - handleSavingObject(); - setIsSavePanelOpen(false); - }} - data-test-subj="eventExplorer__querySaveConfirm" - > - Save - - - - - + )} - + {showSaveButton && !showSavePanelOptionsList && ( + + + + + + )} + {isLiveTailOn && ( + + + + )} + {showSaveButton && searchBarConfigs[selectedSubTabId]?.showSaveButton && ( + <> + + setIsSavePanelOpen(false)} + > + + + + + setIsSavePanelOpen(false)} + data-test-subj="eventExplorer__querySaveCancel" + > + Cancel + + + + { + handleSavingObject(); + setIsSavePanelOpen(false); + }} + data-test-subj="eventExplorer__querySaveConfirm" + > + Save + + + + + + + + )} + + + {!appLogEvents && ( + + + )} {flyout}