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] query editor and UI settings toggle (opensearch-proje…
…ct#7001) * [Discover-next] query editor and UI settings toggle Adds new query editor in replacement of query string input. Utilizing: ``` data.enhancements.enabled: true ``` And enabling the Advanced Setting: `query:enhancements:enabled` Also, cleans up the toggling since it is now two different components. Related issue: opensearch-project#6067 Signed-off-by: Kawika Avilla <kavilla414@gmail.com> * Remove commented out code Signed-off-by: Kawika Avilla <kavilla414@gmail.com> --------- Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
- Loading branch information
Showing
42 changed files
with
1,803 additions
and
640 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 @@ | ||
feat: | ||
- Query editor and UI settings toggle ([#7001](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7001)) |
25 changes: 15 additions & 10 deletions
25
...ic/application/components/dashboard_listing/__snapshots__/dashboard_listing.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
30 changes: 18 additions & 12 deletions
30
...ic/application/components/dashboard_top_nav/__snapshots__/dashboard_top_nav.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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@import "./language_selector"; | ||
@import "./query_editor"; |
14 changes: 14 additions & 0 deletions
14
src/plugins/data/public/ui/query_editor/_language_selector.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,14 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
.languageSelector { | ||
max-width: 140px; | ||
height: 100%; | ||
|
||
&:first-child { | ||
div:first-child { | ||
height: 100%; | ||
} | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
src/plugins/data/public/ui/query_editor/_query_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,44 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
.osdQueryEditor__wrap { | ||
height: 200px; | ||
width: 500px; | ||
} | ||
|
||
.osdQueryEditorHeader { | ||
max-height: 400px; | ||
|
||
// TODO fix styling: with "overflow: auto" the scroll bar appears although the content is below max-height | ||
// overflow: auto; | ||
} | ||
|
||
@include euiBreakpoint("xs", "s") { | ||
.osdQueryEditor--withDatePicker { | ||
> :first-child { | ||
// Change the order of the query bar and date picker so that the date picker is top | ||
// and the query bar still aligns with filters | ||
order: 1; | ||
|
||
// EUI Flexbox adds too much margin between responded items, this just moves it up | ||
margin-top: $euiSizeS * -1; | ||
} | ||
} | ||
} | ||
|
||
// IE specific fix for the datepicker to not collapse | ||
@include euiBreakpoint("m", "l", "xl") { | ||
.osdQueryEditor__datePickerWrapper { | ||
max-width: 40vw; | ||
flex-grow: 0 !important; | ||
flex-basis: auto !important; | ||
|
||
&.osdQueryEditor__datePickerWrapper-isHidden { | ||
width: 0; | ||
overflow: hidden; | ||
max-width: 0; | ||
} | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/plugins/data/public/ui/query_editor/fetch_index_patterns.ts
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,42 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { isEmpty } from 'lodash'; | ||
import { IUiSettingsClient, SavedObjectsClientContract } from 'src/core/public'; | ||
import { indexPatterns, IndexPatternAttributes } from '../..'; | ||
|
||
export async function fetchIndexPatterns( | ||
savedObjectsClient: SavedObjectsClientContract, | ||
indexPatternStrings: string[], | ||
uiSettings: IUiSettingsClient | ||
) { | ||
if (!indexPatternStrings || isEmpty(indexPatternStrings)) { | ||
return []; | ||
} | ||
|
||
const searchString = indexPatternStrings.map((string) => `"${string}"`).join(' | '); | ||
const indexPatternsFromSavedObjects = await savedObjectsClient.find<IndexPatternAttributes>({ | ||
type: 'index-pattern', | ||
fields: ['title', 'fields'], | ||
search: searchString, | ||
searchFields: ['title'], | ||
}); | ||
|
||
const exactMatches = indexPatternsFromSavedObjects.savedObjects.filter((savedObject) => { | ||
return indexPatternStrings.includes(savedObject.attributes.title); | ||
}); | ||
|
||
const defaultIndex = uiSettings.get('defaultIndex'); | ||
|
||
const allMatches = | ||
exactMatches.length === indexPatternStrings.length | ||
? exactMatches | ||
: [ | ||
...exactMatches, | ||
await savedObjectsClient.get<IndexPatternAttributes>('index-pattern', defaultIndex), | ||
]; | ||
|
||
return allMatches.map(indexPatterns.getFromSavedObject); | ||
} |
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,26 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { withOpenSearchDashboards } from '../../../../opensearch_dashboards_react/public'; | ||
import type { QueryEditorTopRowProps } from './query_editor_top_row'; | ||
import type { QueryEditorProps } from './query_editor'; | ||
|
||
const Fallback = () => <div />; | ||
|
||
const LazyQueryEditorTopRow = React.lazy(() => import('./query_editor_top_row')); | ||
export const QueryEditorTopRow = (props: QueryEditorTopRowProps) => ( | ||
<React.Suspense fallback={<Fallback />}> | ||
<LazyQueryEditorTopRow {...props} /> | ||
</React.Suspense> | ||
); | ||
|
||
const LazyQueryEditorUI = withOpenSearchDashboards(React.lazy(() => import('./query_editor'))); | ||
export const QueryEditor = (props: QueryEditorProps) => ( | ||
<React.Suspense fallback={<Fallback />}> | ||
<LazyQueryEditorUI {...props} /> | ||
</React.Suspense> | ||
); | ||
export type { QueryEditorProps }; |
Oops, something went wrong.