forked from opensearch-project/OpenSearch-Dashboards
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New query bar #30
Draft
abbyhu2000
wants to merge
11
commits into
main
Choose a base branch
from
new_query_barr
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
New query bar #30
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ca8e703
changes
abbyhu2000 66e706c
Add toggle and single line query editor for DQL/lucene
abbyhu2000 384693d
add conditional render on filter bar
abbyhu2000 63414b3
Add footer into query extension service
abbyhu2000 bd7fcc5
move toggle state into query editor state, remove data source footer ref
abbyhu2000 d33c62e
attempt to use display:none to hide footer
abbyhu2000 3f406e9
new changes
abbyhu2000 b2da624
continue working on footer service
abbyhu2000 0302a67
footer bar
abbyhu2000 c51ed7c
move timer picker to be on top
abbyhu2000 0078f65
removeFooterRef
abbyhu2000 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
src/plugins/data/public/ui/query_editor/collapsed_query_bar.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Any modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
import React, { RefObject, createRef, useState } from 'react'; | ||
import { i18n } from '@osd/i18n'; | ||
|
||
import { EuiFieldText, EuiOutsideClickDetector, EuiPortal, Query } from '@elastic/eui'; | ||
import { SuggestionsComponent } from '../typeahead'; | ||
|
||
export interface CollapsedQueryBarInputProps { | ||
initialValue: string; | ||
onChange?: (query: string) => void; | ||
} | ||
|
||
export const CollapsedQueryBarInput: React.FC<CollapsedQueryBarInputProps> = (props) => { | ||
const [isSuggestionsVisible, setIsSuggestionsVisible] = useState(false); | ||
const [suggestionIndex, setSuggestionIndex] = useState<number | null>(null); | ||
const [value, setValue] = useState(props.initialValue ?? ''); | ||
|
||
return ( | ||
<EuiOutsideClickDetector onOutsideClick={() => setIsSuggestionsVisible(false)}> | ||
<div> | ||
<EuiFieldText | ||
data-test-subj="collapsed-query-bar-input-field-text" | ||
value={value} | ||
onClick={() => setIsSuggestionsVisible(true)} | ||
onChange={(e) => setValue(e.target.value)} | ||
onKeyDown={() => setIsSuggestionsVisible(true)} | ||
placeholder={''} | ||
fullWidth | ||
/> | ||
<EuiPortal> | ||
<SuggestionsComponent | ||
show={isSuggestionsVisible} | ||
suggestions={[]} | ||
index={suggestionIndex} | ||
onClick={(suggestion) => { | ||
return; | ||
}} | ||
onMouseEnter={(i) => setSuggestionIndex(i)} | ||
loadMore={() => {}} | ||
size="s" | ||
/> | ||
</EuiPortal> | ||
</div> | ||
</EuiOutsideClickDetector> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/plugins/data/public/ui/query_editor/query_editor_btn_collapse.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Any modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { i18n } from '@osd/i18n'; | ||
import { EuiToolTip, EuiButtonIcon } from '@elastic/eui'; | ||
|
||
export interface Props { | ||
onClick: () => void; | ||
isCollapsed: boolean; | ||
} | ||
|
||
export function QueryEditorBtnCollapse({ onClick, isCollapsed }: Props) { | ||
const label = i18n.translate('queryEditor.collapse', { | ||
defaultMessage: 'Toggle query editor', | ||
}); | ||
return ( | ||
<EuiToolTip content={label}> | ||
<EuiButtonIcon | ||
aria-expanded={!isCollapsed} | ||
aria-label={label} | ||
data-test-subj="queryEditorCollapseBtn" | ||
onClick={() => onClick()} | ||
iconType={!isCollapsed ? 'arrowRight' : 'arrowDown'} | ||
iconSize={'s'} | ||
/> | ||
</EuiToolTip> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can add this boolean here: https://github.com/opensearch-project/OpenSearch-Dashboards/blob/96fb9d629e6539db4dacd922df3fff6809fdb407/src/plugins/data/public/ui/types.ts#L23