-
Notifications
You must be signed in to change notification settings - Fork 918
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
Created language manager inside query string service #7756
Created language manager inside query string service #7756
Conversation
1ef8075
to
cf615f8
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7756 +/- ##
===========================================
- Coverage 63.83% 52.56% -11.27%
===========================================
Files 3655 3147 -508
Lines 81126 69225 -11901
Branches 12923 10747 -2176
===========================================
- Hits 51783 36387 -15396
- Misses 26165 30994 +4829
+ Partials 3178 1844 -1334
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: abbyhu2000 <[email protected]>
Signed-off-by: abbyhu2000 <[email protected]>
Signed-off-by: abbyhu2000 <[email protected]>
1b5a865
to
04e0dc8
Compare
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.
nothing blocking (besides test failures).
some comments. also do we not want to register a default languages using the language manager?
i know we discussed before but putting for context.
@@ -22,21 +21,49 @@ export interface DataSettings { | |||
}; | |||
} | |||
|
|||
export class Settings { | |||
export class LanguageManager { | |||
private isEnabled = false; |
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.
i think this can be removed
private isEnabled = false; | ||
private enabledQueryEnhancementsUpdated$ = new BehaviorSubject<boolean>(this.isEnabled); | ||
private enhancedAppNames: string[] = []; | ||
private queryEnhancements: Map<string, QueryEnhancement>; | ||
private queryEditorExtensionMap: Record<string, QueryEditorExtensionConfig>; |
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.
should be apart of the query enhancement
@@ -135,10 +135,10 @@ export class SearchService implements Plugin<ISearchSetup, ISearchStart> { | |||
{ fieldFormats, indexPatterns }: SearchServiceStartDependencies | |||
): ISearchStart { | |||
const search = ((request, options) => { | |||
const queryString = getQueryService().queryString; | |||
const selectedLanguage = getQueryService().queryString.getQuery().language; |
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 use the constant you create on queryString.getQuery().language
@@ -46,6 +39,10 @@ export { | |||
QueryEditorExtensions, | |||
QueryEditorExtensionDependencies, | |||
QueryEditorExtensionConfig, | |||
createEditor, |
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.
how do we intend to use this? (sorry if it's explained later in PR).
exporting components which devs can handle the state and prop or do they access it by the ui service?
import { getQueryService, getIndexPatterns } from '../../services'; | ||
import { DataSettings } from '../../query/query_string/language_manager/language_manager'; |
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.
nit: do you have an index file defined here that exports the stuff you want to export, so you can just have ../../query/query_string/language_manager
// const dateRangeEnhancement = enhancement?.searchBar?.dateRange; | ||
// const dateRange = dateRangeEnhancement | ||
// ? { | ||
// from: dateRangeEnhancement.initialFrom!, |
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.
i dont think we need this anymore. we did this initially because I thought quick date ranges like "Last 30 days" "Last 15 minutes" didn't work for PPL queries since I append the the date picker time filter to the query. but it should work with those quick ranges because we have a helper function to convert it
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.
or we can double down and have a formatDateRange
handler when you register a language
.getQueryEnhancements(this.state.query?.language!); | ||
|
||
// if it is an enhanced language, check the filterable field | ||
if (enhancement) { |
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.
nice!
}, | ||
}; | ||
} | ||
public setup(core: CoreSetup, {}: UiServiceSetupDependencies): any {} |
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.
this should be IUiSetup
just need to update the type IUiSetup to be what you expect now in this case empty
@@ -83,7 +57,6 @@ export class UiService implements Plugin<IUiSetup, IUiStart> { | |||
), | |||
SearchBar, | |||
SuggestionsComponent, |
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.
Continue a comment from above, it seems like we do not expose the createEditor function from here. do people access it from the SearchBar?
Description
Issues Resolved
Screenshot
Testing the changes
Changelog
Check List
yarn test:jest
yarn test:jest_integration