diff --git a/CHANGELOG.md b/CHANGELOG.md index 59a9247306f7..30258724f82a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,32 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### Deprecations +### 🛡 Security + +### 📈 Features/Enhancements + +### 🐛 Bug Fixes + +- [BUG][Discover] Allow saved sort from search embeddable to load in Dashboard ([#5934](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5934)) +- [BUG][Discover] Add key to index pattern options for support deplicate index pattern names([#5946](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5946)) +- [Discover] Fix table cell content overflowing in Safari ([#5948](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5948)) + +### 🚞 Infrastructure + +### 📝 Documentation + +### 🛠 Maintenance + +### 🪛 Refactoring + +### 🔩 Tests + +## [2.12.0 - 2024-02-20](https://github.com/opensearch-project/OpenSearch-Dashboards/releases/tag/2.12.0) + +### 💥 Breaking Changes + +### Deprecations + - Rename `withLongNumerals` to `withLongNumeralsSupport` in `HttpFetchOptions` [#5592](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5592) ### 🛡 Security @@ -70,8 +96,6 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [BUG] Remove duplicate sample data as id 90943e30-9a47-11e8-b64d-95841ca0b247 ([5668](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5668)) - [BUG][Multiple Datasource] Fix datasource testing connection unexpectedly passed with wrong endpoint [#5663](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5663) - [Table Visualization] Fix filter action buttons for split table aggregations ([#5619](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5619)) -- [BUG][Discover] Allow saved sort from search embeddable to load in Dashboard ([#5934](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5934)) -- [Discover] Fix table cell content overflowing in Safari ([#5948](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5948)) ### 🚞 Infrastructure diff --git a/src/plugins/data/public/data_sources/datasource_selector/datasource_selectable.test.tsx b/src/plugins/data/public/data_sources/datasource_selector/datasource_selectable.test.tsx index 3e6c99e420d6..63c2437cc7b3 100644 --- a/src/plugins/data/public/data_sources/datasource_selector/datasource_selectable.test.tsx +++ b/src/plugins/data/public/data_sources/datasource_selector/datasource_selectable.test.tsx @@ -181,4 +181,47 @@ describe('DataSourceSelectable', () => { ]; expect(optionTexts).toEqual(expectedIndexPatternSortedOrder); }); + + it('should allow display and selection of duplicated index patterns based on unique key', async () => { + const mockDataSourceOptionListWithDuplicates = [ + { + label: 'Index patterns', + options: [ + { label: 'duplicate-index-pattern', key: 'unique-key-1' }, + { label: 'unique-index-pattern-1', key: 'unique-key-2' }, + { label: 'duplicate-index-pattern', key: 'unique-key-3' }, + { label: 'unique-index-pattern-2', key: 'unique-key-4' }, + ], + }, + ] as any; + + const handleSelect = jest.fn(); + + render( + + ); + + const button = screen.getByLabelText('Open list of options'); + fireEvent.click(button); + + const optionsToSelect = screen.getAllByText('duplicate-index-pattern'); + fireEvent.click(optionsToSelect[1]); + + expect(handleSelect).toHaveBeenCalledWith( + expect.objectContaining([{ key: 'unique-key-3', label: 'duplicate-index-pattern' }]) + ); + }); }); diff --git a/src/plugins/data/public/data_sources/datasource_selector/datasource_selectable.tsx b/src/plugins/data/public/data_sources/datasource_selector/datasource_selectable.tsx index 1c6876815a0e..88abe18aa143 100644 --- a/src/plugins/data/public/data_sources/datasource_selector/datasource_selectable.tsx +++ b/src/plugins/data/public/data_sources/datasource_selector/datasource_selectable.tsx @@ -52,6 +52,7 @@ export const getSourceOptions = (dataSource: DataSourceType, dataSet: DataSetTyp ...optionContent, label: dataSet.title, value: dataSet.id, + key: dataSet.id, }; } return {