[Bug] Data-view drop down#11392
Conversation
Signed-off-by: Adam Tackett <tackadam@amazon.com>
PR Reviewer Guide 🔍(Review updated until commit a8b20fb)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to a8b20fb Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit 75ba9bf
Suggestions up to commit 1d74ce6
Suggestions up to commit 1d74ce6
Suggestions up to commit 5987728
Suggestions up to commit 97de49c
|
|
Persistent review updated to latest commit 09465b5 |
1 similar comment
|
Persistent review updated to latest commit 09465b5 |
Signed-off-by: Adam Tackett <tackadam@amazon.com>
|
Persistent review updated to latest commit d53e171 |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #11392 +/- ##
==========================================
+ Coverage 61.21% 61.23% +0.01%
==========================================
Files 4985 4985
Lines 136862 136886 +24
Branches 23889 23902 +13
==========================================
+ Hits 83786 83823 +37
+ Misses 47072 47059 -13
Partials 6004 6004
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| try { | ||
| const dataSource = await this.getDataSource(dataView.dataSourceRef.id); | ||
| if (dataSource) { | ||
| dataSourceInfo = { |
There was a problem hiding this comment.
We can move the common fields into a default dataSourceInfo object to reduce duplication.
There was a problem hiding this comment.
Thanks for suggestion,
Updated to use
const defaultDataSourceInfo = {
id: dataView.dataSourceRef.id,
title: dataView.dataSourceRef.id,
type: dataView.dataSourceRef.type || DEFAULT_DATA.SOURCE_TYPES.OPENSEARCH,
version: '',
};
```
Signed-off-by: Adam Tackett <tackadam@amazon.com>
|
Persistent review updated to latest commit d086df0 |
1 similar comment
|
Persistent review updated to latest commit d086df0 |
|
Persistent review updated to latest commit c860a7d |
|
Persistent review updated to latest commit 97de49c |
Signed-off-by: Adam Tackett <105462877+TackAdam@users.noreply.github.com>
|
Persistent review updated to latest commit 5987728 |
Signed-off-by: Adam Tackett <tackadam@amazon.com>
|
Persistent review updated to latest commit 1d74ce6 |
1 similar comment
|
Persistent review updated to latest commit 1d74ce6 |
Signed-off-by: Adam Tackett <tackadam@amazon.com>
|
Persistent review updated to latest commit 75ba9bf |
Signed-off-by: Adam Tackett <tackadam@amazon.com>
|
Persistent review updated to latest commit a8b20fb |
Description
Fixes multiple bugs in the dataset selector where dataset display names and data source titles were not showing correctly.
Bugs Fixed
Issue: When using external data sources, the selector showed "datasource" instead of the actual data source name (e.g., "DockerTest", "PromTest").
Root Cause: convertToDataset() in data_views.ts was using dataSourceRef.name from SavedObjectReference, which is always "dataSource", instead of fetching the actual data source title.
Fix: Modified convertToDataset() to call getDataSource() and populate the actual data source title and version.
Files Changed:
Issue: Dataset selector showed index pattern title "logs_otel_v1_explore" instead of the saved displayName "LogsExplore".
Root Cause: displayName and description fields were being dropped when loading dataset state from URL parameters.
Fix: Modified redux_persistence.ts to preserve displayName and description when loading from URL state and when creating minimal datasets.
Files Changed:
Issue:
Root Cause: External data source datasets with composite IDs don't reliably retrieve displayName from saved objects after being cached. When switching to another dataset, the previously selected dataset loses its displayName because it's no longer active and the fetched dataset doesn't have the displayName.
Fix: Implemented a ref-based displayNameCache in dataset_select.tsx that preserves displayNames seen from URL state across dataset switches. The cache is populated when a dataset with displayName is encountered (from URL state or fetched dataView), and these cached values are used when rendering dropdown options.
Files Changed:
Why Both redux_persistence.ts and Caching Are Needed
Together, they ensure displayNames are preserved throughout the user's session regardless of which dataset is currently selected.
Testing
Added comprehensive test coverage:
Before:
Before.mov
After:
After.mov
Issues Resolved
Screenshot
Testing the changes
Changelog
Check List
yarn test:jestyarn test:jest_integration