forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Discover][Alerting] Implement editing of dataView, query & filters (e…
…lastic#131688) * [Discover] introduce params editing using unified search * [Discover] fix unit tests * [Discover] fix functional tests * [Discover] fix unit tests * [Discover] return test subject name * [Discover] fix alert functional test * Update x-pack/plugins/stack_alerts/public/alert_types/es_query/expression/search_source_expression_form.tsx Co-authored-by: Julia Rechkunova <[email protected]> * Update x-pack/plugins/stack_alerts/public/alert_types/es_query/expression/search_source_expression_form.tsx Co-authored-by: Matthias Wilhelm <[email protected]> * [Discover] hide filter panel options * [Discover] improve functional test * [Discover] apply suggestions * [Discover] change data view selector * [Discover] fix tests * [Discover] apply suggestions, fix lang mode toggler * [Discover] mote interface to types file, clean up diff * [Discover] fix saved query issue * Update x-pack/plugins/stack_alerts/server/alert_types/es_query/alert_type.ts Co-authored-by: Matthias Wilhelm <[email protected]> * [Discover] remove zIndex * [Discover] omit null searchType from esQuery completely, add isEsQueryAlert check for useSavedObjectReferences hook * [Discover] set searchType to esQuery when needed * [Discover] fix unit tests * Update x-pack/plugins/stack_alerts/server/alert_types/es_query/alert_type_params.ts Co-authored-by: Matthias Wilhelm <[email protected]> * Update x-pack/plugins/stack_alerts/server/alert_types/es_query/alert_type.ts Co-authored-by: Matthias Wilhelm <[email protected]> Co-authored-by: Julia Rechkunova <[email protected]> Co-authored-by: Matthias Wilhelm <[email protected]>
- Loading branch information
1 parent
d344088
commit bc31053
Showing
34 changed files
with
799 additions
and
415 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
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
75 changes: 75 additions & 0 deletions
75
x-pack/plugins/stack_alerts/public/alert_types/components/data_view_select_popover.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,75 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; | ||
import { DataViewSelectPopover } from './data_view_select_popover'; | ||
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; | ||
import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; | ||
import { act } from 'react-dom/test-utils'; | ||
|
||
const props = { | ||
onSelectDataView: () => {}, | ||
initialDataViewTitle: 'kibana_sample_data_logs', | ||
initialDataViewId: 'mock-data-logs-id', | ||
}; | ||
|
||
const dataViewOptions = [ | ||
{ | ||
id: 'mock-data-logs-id', | ||
namespaces: ['default'], | ||
title: 'kibana_sample_data_logs', | ||
}, | ||
{ | ||
id: 'mock-flyghts-id', | ||
namespaces: ['default'], | ||
title: 'kibana_sample_data_flights', | ||
}, | ||
{ | ||
id: 'mock-ecommerce-id', | ||
namespaces: ['default'], | ||
title: 'kibana_sample_data_ecommerce', | ||
typeMeta: {}, | ||
}, | ||
{ | ||
id: 'mock-test-id', | ||
namespaces: ['default'], | ||
title: 'test', | ||
typeMeta: {}, | ||
}, | ||
]; | ||
|
||
const mount = () => { | ||
const dataViewsMock = dataViewPluginMocks.createStartContract(); | ||
dataViewsMock.getIdsWithTitle.mockImplementation(() => Promise.resolve(dataViewOptions)); | ||
|
||
return { | ||
wrapper: mountWithIntl( | ||
<KibanaContextProvider services={{ data: { dataViews: dataViewsMock } }}> | ||
<DataViewSelectPopover {...props} /> | ||
</KibanaContextProvider> | ||
), | ||
dataViewsMock, | ||
}; | ||
}; | ||
|
||
describe('DataViewSelectPopover', () => { | ||
test('renders properly', async () => { | ||
const { wrapper, dataViewsMock } = mount(); | ||
|
||
await act(async () => { | ||
await nextTick(); | ||
wrapper.update(); | ||
}); | ||
|
||
expect(dataViewsMock.getIdsWithTitle).toHaveBeenCalled(); | ||
expect(wrapper.find('[data-test-subj="selectDataViewExpression"]').exists()).toBeTruthy(); | ||
|
||
const getIdsWithTitleResult = await dataViewsMock.getIdsWithTitle.mock.results[0].value; | ||
expect(getIdsWithTitleResult).toBe(dataViewOptions); | ||
}); | ||
}); |
Oops, something went wrong.