forked from opensearch-project/OpenSearch-Dashboards
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Discover Next] Fixes Discover styles (opensearch-project#7546)
* fixes the query bar UI Signed-off-by: Ashwin P Chandran <[email protected]> * incorporates Abby's page styling Signed-off-by: Ashwin P Chandran <[email protected]> * fixes tests Signed-off-by: Ashwin P Chandran <[email protected]> * Changeset file for PR opensearch-project#7546 created/updated --------- Signed-off-by: Ashwin P Chandran <[email protected]> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
- Loading branch information
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.