-
Notifications
You must be signed in to change notification settings - Fork 892
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '2.x' into backport/backport-6385-to-2.x
- Loading branch information
Showing
41 changed files
with
987 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/plugins/data/public/ui/index_pattern_select/index_pattern_select.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
import { shallow } from 'enzyme'; | ||
import { SavedObjectsClientContract } from '../../../../../core/public'; | ||
import React from 'react'; | ||
import IndexPatternSelect from './index_pattern_select'; | ||
|
||
describe('IndexPatternSelect', () => { | ||
let client: SavedObjectsClientContract; | ||
const bulkGetMock = jest.fn(); | ||
|
||
const nextTick = () => new Promise((res) => process.nextTick(res)); | ||
|
||
beforeEach(() => { | ||
client = { | ||
find: jest.fn().mockResolvedValue({ | ||
savedObjects: [ | ||
{ | ||
references: [{ id: 'testDataSourceId', type: 'data-source' }], | ||
attributes: { title: 'testTitle1' }, | ||
}, | ||
{ | ||
references: [{ id: 'testDataSourceId', type: 'data-source' }], | ||
attributes: { title: 'testTitle2' }, | ||
}, | ||
], | ||
}), | ||
bulkGet: bulkGetMock, | ||
get: jest.fn().mockResolvedValue({ | ||
references: [{ id: 'someId', type: 'data-source' }], | ||
attributes: { title: 'testTitle' }, | ||
}), | ||
} as any; | ||
}); | ||
|
||
it('should render index pattern select', async () => { | ||
const onChangeMock = jest.fn(); | ||
const compInstance = shallow( | ||
<IndexPatternSelect | ||
placeholder={'test index pattern'} | ||
indexPatternId={'testId'} | ||
onChange={onChangeMock} | ||
data-test-subj={'testId'} | ||
savedObjectsClient={client} | ||
/> | ||
).instance(); | ||
|
||
bulkGetMock.mockResolvedValue({ savedObjects: [{ attributes: { title: 'test1' } }] }); | ||
compInstance.debouncedFetch(''); | ||
await new Promise((resolve) => setTimeout(resolve, 300)); | ||
await nextTick(); | ||
expect(bulkGetMock).toBeCalledWith([{ id: 'testDataSourceId', type: 'data-source' }]); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...ata_source_management/public/components/data_source_error_menu/data_source_error_menu.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { EuiIcon, EuiText } from '@elastic/eui'; | ||
import React from 'react'; | ||
|
||
export const DataSourceErrorMenu = () => { | ||
return ( | ||
<> | ||
<EuiIcon type={'crossInCircleFilled'} color={'danger'} /> | ||
<EuiText color={'danger'}>Error</EuiText> | ||
</> | ||
); | ||
}; |
5 changes: 5 additions & 0 deletions
5
src/plugins/data_source_management/public/components/data_source_error_menu/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
export { DataSourceErrorMenu } from './data_source_error_menu'; |
60 changes: 14 additions & 46 deletions
60
...nt/public/components/data_source_menu/__snapshots__/create_data_source_menu.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.