Skip to content

Commit

Permalink
Merge branch 'main' into xinrui_AuthMethod_Config
Browse files Browse the repository at this point in the history
  • Loading branch information
xinruiba authored Feb 27, 2024
2 parents 246b1d3 + c1439d1 commit 551f87a
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 3 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

### 🐛 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
Expand Down Expand Up @@ -93,7 +97,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))

### 🚞 Infrastructure

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
<DataSourceSelectable
dataSources={[
({
getDataSet: jest.fn().mockResolvedValue([]),
getType: jest.fn().mockReturnValue('DEFAULT_INDEX_PATTERNS'),
getName: jest.fn().mockReturnValue('Index patterns'),
} as unknown) as DataSourceType,
]}
dataSourceOptionList={mockDataSourceOptionListWithDuplicates}
selectedSources={selectedSourcesMock}
onDataSourceSelect={handleSelect}
setDataSourceOptionList={setDataSourceOptionListMock}
onGetDataSetError={onFetchDataSetErrorMock}
/>
);

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' }])
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export const getSourceOptions = (dataSource: DataSourceType, dataSet: DataSetTyp
...optionContent,
label: dataSet.title,
value: dataSet.id,
key: dataSet.id,
};
}
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@

.osdDocTableCell__source {
.truncate-by-height {
transform: translateY(-1.5px);
margin-bottom: -1.5px;
margin-top: -1.5px;
margin-bottom: -3.5px;
}

dd,
Expand Down

0 comments on commit 551f87a

Please sign in to comment.