-
Notifications
You must be signed in to change notification settings - Fork 935
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* fixes the query bar UI * incorporates Abby's page styling * fixes tests * Changeset file for PR #7546 created/updated --------- (cherry picked from commit 2d8c743) Signed-off-by: Ashwin P Chandran <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
ee561ac
commit 7b1f742
Showing
34 changed files
with
1,017 additions
and
412 deletions.
There are no files selected for viewing
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,2 @@ | ||
fix: | ||
- Fixes Discover next styling ([#7546](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7546)) |
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
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
32 changes: 32 additions & 0 deletions
32
src/plugins/data/public/ui/query_editor/__snapshots__/language_selector.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
@import "./editors/default_editor/default_editor"; | ||
@import "./language_selector"; | ||
@import "./query_editor"; |
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
21 changes: 21 additions & 0 deletions
21
src/plugins/data/public/ui/query_editor/editors/default_editor/_default_editor.scss
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,21 @@ | ||
.defaultEditor__footer { | ||
display: flex; | ||
flex-wrap: nowrap; | ||
background-color: $euiColorLightestShade; | ||
padding: $euiSizeXS; | ||
gap: $euiSizeS; | ||
|
||
.defaultEditor__footerSpacer { | ||
flex-grow: 1; | ||
} | ||
|
||
.defaultEditor__footerItem { | ||
padding: 0 $euiSizeXS; | ||
} | ||
} | ||
|
||
.defaultEditor { | ||
border: $euiBorderThin; | ||
border-radius: $euiSizeXS; | ||
margin: 0 $euiSizeXS $euiSizeXS; | ||
} |
99 changes: 99 additions & 0 deletions
99
src/plugins/data/public/ui/query_editor/editors/default_editor/index.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,99 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { EuiText, EuiTextColorProps } from '@elastic/eui'; | ||
// import { monaco } from '@osd/monaco'; | ||
import { CodeEditor } from '../../../../../../opensearch_dashboards_react/public'; | ||
import { createEditor, SingleLineInput } from '../shared'; | ||
|
||
interface FooterItem { | ||
text: string; | ||
color?: EuiTextColorProps['color']; | ||
} | ||
|
||
interface DefaultInputProps extends React.JSX.IntrinsicAttributes { | ||
languageId: string; | ||
value: string; | ||
onChange: (value: string) => void; | ||
editorDidMount: (editor: any) => void; | ||
footerItems?: { | ||
start?: Array<FooterItem | string>; | ||
end?: Array<FooterItem | string>; | ||
}; | ||
headerRef?: React.RefObject<HTMLDivElement>; | ||
// provideCompletionItems: monaco.languages.CompletionItemProvider['provideCompletionItems']; | ||
} | ||
|
||
const DefaultInput: React.FC<DefaultInputProps> = ({ | ||
languageId, | ||
value, | ||
onChange, | ||
footerItems, | ||
editorDidMount, | ||
headerRef, | ||
// provideCompletionItems, | ||
}) => { | ||
return ( | ||
<div className="defaultEditor"> | ||
<div ref={headerRef} className="defaultEditor__header" /> | ||
<CodeEditor | ||
height={200} | ||
languageId={languageId} | ||
value={value} | ||
onChange={onChange} | ||
editorDidMount={editorDidMount} | ||
options={{ | ||
minimap: { enabled: false }, | ||
scrollBeyondLastLine: false, | ||
fontSize: 14, | ||
fontFamily: 'Roboto Mono', | ||
lineNumbers: 'on', | ||
folding: true, | ||
wordWrap: 'on', | ||
wrappingIndent: 'same', | ||
lineDecorationsWidth: 0, | ||
lineNumbersMinChars: 2, | ||
}} | ||
// suggestionProvider={{ | ||
// provideCompletionItems, | ||
// }} | ||
// languageConfiguration={{ | ||
// language: , | ||
// autoClosingPairs: [ | ||
// { open: '(', close: ')' }, | ||
// { open: '[', close: ']' }, | ||
// { open: '{', close: '}' }, | ||
// { open: '"', close: '"' }, | ||
// { open: "'", close: "'" }, | ||
// ], | ||
// }} | ||
/> | ||
{footerItems && ( | ||
<div className="defaultEditor__footer"> | ||
{footerItems.start?.map((item, index) => ( | ||
<FooterItem key={index} item={item} /> | ||
))} | ||
<div className="defaultEditor__footerSpacer" /> | ||
{footerItems.end?.map((item, index) => ( | ||
<FooterItem key={index} item={item} /> | ||
))} | ||
</div> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
const FooterItem: React.FC<{ item: FooterItem | string }> = ({ item }) => { | ||
const color = typeof item === 'string' ? ('subdued' as const) : item.color; | ||
const text = typeof item === 'string' ? item : item.text; | ||
return ( | ||
<EuiText size="xs" className="defaultEditor__footerItem" color={color}> | ||
{text} | ||
</EuiText> | ||
); | ||
}; | ||
|
||
export const createDefaultEditor = createEditor(SingleLineInput, null, DefaultInput); |
Oops, something went wrong.