-
Notifications
You must be signed in to change notification settings - Fork 916
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
[MDS] TSVB Support #6298
[MDS] TSVB Support #6298
Conversation
Signed-off-by: Huy Nguyen <[email protected]>
Signed-off-by: Huy Nguyen <[email protected]>
Signed-off-by: Huy Nguyen <[email protected]>
Signed-off-by: Huy Nguyen <[email protected]>
Signed-off-by: Huy Nguyen <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6298 +/- ##
===========================================
+ Coverage 49.55% 67.40% +17.84%
===========================================
Files 2670 2639 -31
Lines 54290 50276 -4014
Branches 8878 9086 +208
===========================================
+ Hits 26906 33889 +6983
+ Misses 25720 14236 -11484
- Partials 1664 2151 +487
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: Huy Nguyen <[email protected]>
Hi @huyaboo I re-run failed |
As we are adding a new file |
@@ -44,21 +44,24 @@ export async function getFields( | |||
requestContext: RequestHandlerContext, | |||
request: OpenSearchDashboardsRequest, | |||
framework: Framework, | |||
indexPattern: string | |||
indexPattern: string, | |||
dataSourceId: string | null |
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.
+1 to @BionIT. Instead of null
can we make optional parameter? If this is just because of router schema, then I would prefer fixing in router schema instead of workaround to support that. How much is the effort?
|
||
export const decideLegacyClient = ( | ||
requestContext: RequestHandlerContext, | ||
dataSourceId: string | null |
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: let's use optional parameter instead of null.
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.
We have decideClient in https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/src/plugins/data/server/search/opensearch_search/decide_client.ts.
-
Can we use same file for
decideLegacyClient
? -
Can we use request to get dataSourceId similar to decideClient?
OR
maybe refactor decideClient to return legacy client base on additional parameter? -
I can see in decideClient we are supporting LongNumerals. Is it something we need to take for legacy client? Can you double check?
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 found this function
const decideClient = async ( |
Looks like we have added this function while adding MDS feature. can we use same one?
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.
Wrote a workaround to use decideClient()
but this will need a refactor because other plugins may need this function as well. Raised a new issue to address this #6417
src/plugins/vis_type_timeseries/public/application/components/annotations_editor.js
Show resolved
Hide resolved
...gins/vis_type_timeseries/server/lib/search_strategies/strategies/abstract_search_strategy.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Huy Nguyen <[email protected]>
Signed-off-by: Huy Nguyen <[email protected]>
65 successful and 1 skipped checks before rebase. |
@huyaboo Thank you for making this change and patiently hearing everyone's comments and feedback and addressing them. Greatly appreciate your contribution! |
fullWidth={false} | ||
removePrepend={true} | ||
isClearable={false} | ||
hideLocalCluster={!!getHideLocalCluster().hideLocalCluster} |
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 don't think we need to set hideLocalCluster
any more. As #6361 merged in, this prop will be decided by the data source management plugin. Whatever get passed in explicitly by the props, will be overwritten anyways.
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.
Removed all instances of hideLocalCluster
dataSourceManagement: DataSourceManagementPluginSetup | undefined; | ||
}>('DataSourceManagementSetup'); | ||
|
||
export const [getHideLocalCluster, setHideLocalCluster] = createGetterSetter<{ |
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.
similar to my previous comment, this also can be removed
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.
Removed all instances of hideLocalCluster
Signed-off-by: Huy Nguyen <[email protected]>
savedObjectsClient={getSavedObjectsClient().client} | ||
notifications={getNotifications().toasts} | ||
onSelectedDataSource={handleDataSourceSelectChange} | ||
defaultOption={model.data_source_id ? [{ id: model.data_source_id }] : [{ id: '' }]} |
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.
shall we let the selector to decide the default data source if not provided?
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.
Yeah fixed it. I realized there could be a case where the data_source_id
can be undefined
and the local cluster is disabled.
import { PanelSchema } from 'src/plugins/vis_type_timeseries/common/types'; | ||
import { DATA_SOURCE_ID_KEY } from '../../../../common/constants'; | ||
|
||
export const createDataSourcePickerHandler = (handleChange: (e: PanelSchema) => void) => { |
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.
do we have a test for this function?
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.
Added test cases.
…d be local cluster Signed-off-by: Huy Nguyen <[email protected]>
Signed-off-by: Huy Nguyen <[email protected]>
* Add MDS support to TSVB Signed-off-by: Huy Nguyen <[email protected]> * Refactor datasource picker component Signed-off-by: Huy Nguyen <[email protected]> * Allow picker to persist state Signed-off-by: Huy Nguyen <[email protected]> * Refactored picker component params Signed-off-by: Huy Nguyen <[email protected]> * Add unit tests Signed-off-by: Huy Nguyen <[email protected]> * Add to CHANGELOG Signed-off-by: Huy Nguyen <[email protected]> * Refactor components to use hideLocalCluster Signed-off-by: Huy Nguyen <[email protected]> * Remove Picker wrapper Signed-off-by: Huy Nguyen <[email protected]> * Update selector component and rename field to index name Signed-off-by: Huy Nguyen <[email protected]> * Address comments Signed-off-by: Huy Nguyen <[email protected]> * Refactor to use different decideClient Signed-off-by: Huy Nguyen <[email protected]> * Add optional arg Signed-off-by: Huy Nguyen <[email protected]> * Remove hidelocalcluster as a setting Signed-off-by: Huy Nguyen <[email protected]> * Fixed case where local cluster is disabled but the datasource id could be local cluster Signed-off-by: Huy Nguyen <[email protected]> * Add test for create data source picker handler Signed-off-by: Huy Nguyen <[email protected]> --------- Signed-off-by: Huy Nguyen <[email protected]> (cherry picked from commit be0f9d5) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md
* Add MDS support to TSVB Signed-off-by: Huy Nguyen <[email protected]> * Refactor datasource picker component Signed-off-by: Huy Nguyen <[email protected]> * Allow picker to persist state Signed-off-by: Huy Nguyen <[email protected]> * Refactored picker component params Signed-off-by: Huy Nguyen <[email protected]> * Add unit tests Signed-off-by: Huy Nguyen <[email protected]> * Add to CHANGELOG Signed-off-by: Huy Nguyen <[email protected]> * Refactor components to use hideLocalCluster Signed-off-by: Huy Nguyen <[email protected]> * Remove Picker wrapper Signed-off-by: Huy Nguyen <[email protected]> * Update selector component and rename field to index name Signed-off-by: Huy Nguyen <[email protected]> * Address comments Signed-off-by: Huy Nguyen <[email protected]> * Refactor to use different decideClient Signed-off-by: Huy Nguyen <[email protected]> * Add optional arg Signed-off-by: Huy Nguyen <[email protected]> * Remove hidelocalcluster as a setting Signed-off-by: Huy Nguyen <[email protected]> * Fixed case where local cluster is disabled but the datasource id could be local cluster Signed-off-by: Huy Nguyen <[email protected]> * Add test for create data source picker handler Signed-off-by: Huy Nguyen <[email protected]> --------- Signed-off-by: Huy Nguyen <[email protected]> (cherry picked from commit be0f9d5) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: ZilongX <[email protected]>
Description
Currently, multiple data source (MDS) does not support TSVB visualizations. This PR adds a data source picker component to the TSVB
Panel options
page so users can specify which datasource to get index patterns from.Issues Resolved
Partially addresses #6290 and closes #6005
Screenshot
Screen.Recording.2024-03-29.at.10.26.07.AM.mov
Testing the changes
Check List
yarn test:jest
yarn test:jest_integration