[8.6] [RAM] Fix broken action type filter in rules list (#145691) (#145809)

# Backport

This will backport the following commits from `main` to `8.6`:
- [[RAM] Fix broken action type filter in rules list
(#145691)](https://github.com/elastic/kibana/pull/145691)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Julian
Gernun","email":"17549662+jcger@users.noreply.github.com"},"sourceCommit":{"committedDate":"2022-11-21T08:18:34Z","message":"[RAM]
Fix broken action type filter in rules list (#145691)\n\n##
Summary\r\n\r\nCloses
202652963-205d1590-5cdf-4b4c-8f8b-e1133e6c274c.mov\r\n\r\n###
Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"87c64dd14a6d9c508249a55036ca7c13ee33363b","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["backport","release_note:fix","Team:ResponseOps","ci:cloud-deploy","v8.6.0","v8.7.0"],"number":145691,"url":"https://github.com/elastic/kibana/pull/145691","mergeCommit":{"message":"[RAM]
Fix broken action type filter in rules list (#145691)\n\n##
Summary\r\n\r\nCloses
202652963-205d1590-5cdf-4b4c-8f8b-e1133e6c274c.mov\r\n\r\n###
Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"87c64dd14a6d9c508249a55036ca7c13ee33363b"}},"sourceBranch":"main","suggestedTargetBranches":["8.6"],"targetPullRequestStates":[{"branch":"8.6","label":"v8.6.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/145691","number":145691,"mergeCommit":{"message":"[RAM]
Fix broken action type filter in rules list (#145691)\n\n##
Summary\r\n\r\nCloses
202652963-205d1590-5cdf-4b4c-8f8b-e1133e6c274c.mov\r\n\r\n###
Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"87c64dd14a6d9c508249a55036ca7c13ee33363b"}}]}]
BACKPORT-->

Co-authored-by: Julian Gernun <17549662+jcger@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2022-11-21 04:21:41 -05:00 committed by GitHub
parent 9e75cc2576
commit 310dd4177f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 1 deletions

View file

@ -555,6 +555,35 @@ describe('rules_list component with props', () => {
await setup();
expect(wrapper.find('ActionTypeFilter')).toHaveLength(1);
});
it('filters when the action type filter is changed', async () => {
wrapper = mountWithIntl(<RulesList />);
await act(async () => {
await nextTick();
wrapper.update();
});
(getIsExperimentalFeatureEnabled as jest.Mock<any, any>).mockImplementation(() => true);
loadRulesWithKueryFilter.mockReset();
await setup();
wrapper.find(`[data-test-subj="actionTypeFilterButton"]`).first().simulate('click');
await act(async () => {
await nextTick();
wrapper.update();
});
wrapper.find(`[data-test-subj="actionTypetestFilterOption"]`).first().simulate('click');
expect(
wrapper.find('[data-test-subj="actionTypetestFilterOption"] EuiIcon[type="check"]').exists()
).toBeTruthy(); // tick icon is being shown
expect(
wrapper
.find('[data-test-subj="actionTypetest2FilterOption"] EuiIcon[type="empty"]')
.exists()
).toBeTruthy(); // doesnt have a tick icon
expect(
wrapper.find('[data-test-subj="actionTypeFilterButton"] .euiNotificationBadge').text()
).toEqual('1'); // badge is being shown
});
});
describe('showCreateRuleButton prop', () => {

View file

@ -644,7 +644,7 @@ export const RulesList = ({
key="action-type-filter"
actionTypes={actionTypes}
onChange={setActionTypesFilter}
filters={typesFilter}
filters={actionTypesFilter}
/>
),
...getRuleOutcomeOrStatusFilter(),