-
Notifications
You must be signed in to change notification settings - Fork 1k
[MD] Concatenate data source name with index pattern name and change delimiter to double colon #5907
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
Conversation
Signed-off-by: Lu Yu <[email protected]>
Signed-off-by: Lu Yu <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5907 +/- ##
==========================================
+ Coverage 66.98% 67.01% +0.02%
==========================================
Files 3305 3305
Lines 63574 63585 +11
Branches 10153 10155 +2
==========================================
+ Hits 42587 42609 +22
+ Misses 18520 18506 -14
- Partials 2467 2470 +3
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: Lu Yu <[email protected]>
Can we add local cluster prefix for index pattern created from local cluster index for consistent look? cc: @kgcreative |
I think that makes sense. What do you think, @BionIT? |
With concatenated names, would that also resolve the current bug of not being able to create an index pattern with the same name against two clusters? Today, if I create an index pattern named We can update the unique names requirement to only check for unique index pattern names against the same data source |
I think that would make it confusing if user doesn't know what does |
const dataSourcesToFetch: Array<{ type: string; id: string }> = []; | ||
savedObjects.map((indexPatternSavedObject: SimpleSavedObject<any>) => { | ||
const dataSourceReference = getDataSourceReference(indexPatternSavedObject.references); | ||
if (dataSourceReference && !this.state.dataSourceIdToTitle.has(dataSourceReference.id)) { | ||
dataSourcesToFetch.push({ type: 'data-source', id: dataSourceReference.id }); | ||
} | ||
}); | ||
|
||
const dataSourceIdToTitleToUpdate = new Map(); | ||
|
||
if (dataSourcesToFetch.length > 0) { | ||
const resp = await savedObjectsClient.bulkGet(dataSourcesToFetch); | ||
resp.savedObjects.map((dataSourceSavedObject: SimpleSavedObject<any>) => { | ||
dataSourceIdToTitleToUpdate.set( | ||
dataSourceSavedObject.id, | ||
dataSourceSavedObject.attributes.title | ||
); | ||
}); | ||
} | ||
|
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 we move this code to getTitle? We have index pattern id, saved object client to find reference, right? We don't have to pass third parameter. Otherwise consumer of getTitle always needs to pass map with data source id and title? Instead can getTitle function handle that?
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 part of code would perform bulk get index patterns(existing behavior), the added behavior is if the referred data source doesn't exist in the current state, it will fetch the data sources in bulk. Note there is only 2 requests here. The getTitle function is only used for selected index pattern which is a single index pattern, the existing behavior is it use an index pattern id to make individual call to saved object API to get the index pattern title, and if we use this function to handle all index patterns, this would multiple by number of index patterns, then to add data source title would double the requests.
If we want to refactor this, I can extract the logic here to a function to perform bulk operation and to produce the idToTitle map
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.
Got it. No need to extract for now. We need to unify the pickers from all screen and that would be another effort. Thanks for the change.
But we do have Local cluster option in cluster selector. Do you mean when multi data source feature is disabled? |
That's the place for user to select the source and not for adding to the existing title, if we look at 1) data picker in discover, 2) in index pattern management page, 3) in saved objects management, none of them show the |
Let's keep this issue scoped. I would prefer we don't change the way we display |
Approved the change. But can you check why several checks are failing? |
…delimiter to double colon (#5907) * concatenate data source name with index pattern name Signed-off-by: Lu Yu <[email protected]> * add changelog Signed-off-by: Lu Yu <[email protected]> * add tests Signed-off-by: Lu Yu <[email protected]> --------- Signed-off-by: Lu Yu <[email protected]> (cherry picked from commit 4ab0ca8) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…delimiter to double colon (#5907) (#5930) * concatenate data source name with index pattern name * add changelog * add tests --------- (cherry picked from commit 4ab0ca8) Signed-off-by: Lu Yu <[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>
…delimiter to double colon (opensearch-project#5907) * concatenate data source name with index pattern name Signed-off-by: Lu Yu <[email protected]> * add changelog Signed-off-by: Lu Yu <[email protected]> * add tests Signed-off-by: Lu Yu <[email protected]> --------- Signed-off-by: Lu Yu <[email protected]>
Description
This change adds data source name as a prefix to the index pattern name for the index pattern selector. This change also changed the delimiter for the datasource name and index pattern name to be double colons by changing getIndexPatternTitle function which is used by index pattern service(
OpenSearch-Dashboards/src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts
Line 127 in eff7cb5
OpenSearch-Dashboards/src/plugins/saved_objects_management/server/routes/find.ts
Line 99 in eff7cb5
Issues Resolved
Fixes #5900
Screenshot
concatdsnameandindexname.mp4
Testing the changes
The following steps were performed to test the change in the recording:
add layer
, then see the index pattern selector with options populatedControls
, then clickAdd
, will see index pattern selector with options populated correctlyadd layer
, then see the index pattern selector with options populated, data source name is added as prefix before the index pattern name and the delimiter is double colonCheck List
yarn test:jest
yarn test:jest_integration