Skip to content

Commit

Permalink
[Security Solution][Exceptions] - Updates exception item find sort fi…
Browse files Browse the repository at this point in the history
…eld (#76685)

## Summary

This is a bug that was introduced by moi in 76537. This previous PR added a sort_field and sort_order to the call for fetching exception lists' items so that the exception item order in the viewer wouldn't jump around any time there was an update. I noticed however that when a rule had both endpoint and detection lists associated with it, when trying to fetch items from both types of lists, the following error shows:

```
"Unable to sort multiple types by field created_at, not a root property"
```
  • Loading branch information
yctercero authored Sep 4, 2020
1 parent d2156b7 commit 8276afd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions x-pack/plugins/lists/public/exceptions/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ describe('Exceptions Lists API', () => {
namespace_type: 'single,single',
page: '1',
per_page: '20',
sort_field: 'created_at',
sort_field: 'exception-list.created_at',
sort_order: 'desc',
},
signal: abortCtrl.signal,
Expand Down Expand Up @@ -408,7 +408,7 @@ describe('Exceptions Lists API', () => {
namespace_type: 'single',
page: '1',
per_page: '20',
sort_field: 'created_at',
sort_field: 'exception-list.created_at',
sort_order: 'desc',
},
signal: abortCtrl.signal,
Expand Down Expand Up @@ -441,7 +441,7 @@ describe('Exceptions Lists API', () => {
namespace_type: 'agnostic',
page: '1',
per_page: '20',
sort_field: 'created_at',
sort_field: 'exception-list.created_at',
sort_order: 'desc',
},
signal: abortCtrl.signal,
Expand Down Expand Up @@ -474,7 +474,7 @@ describe('Exceptions Lists API', () => {
namespace_type: 'agnostic',
page: '1',
per_page: '20',
sort_field: 'created_at',
sort_field: 'exception-list.created_at',
sort_order: 'desc',
},
signal: abortCtrl.signal,
Expand Down Expand Up @@ -508,7 +508,7 @@ describe('Exceptions Lists API', () => {
namespace_type: 'agnostic',
page: '1',
per_page: '20',
sort_field: 'created_at',
sort_field: 'exception-list.created_at',
sort_order: 'desc',
},
signal: abortCtrl.signal,
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/lists/public/exceptions/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ export const fetchExceptionListsItemsByListIds = async ({
namespace_type: namespaceTypes.join(','),
page: pagination.page ? `${pagination.page}` : '1',
per_page: pagination.perPage ? `${pagination.perPage}` : '20',
sort_field: 'created_at',
sort_field: 'exception-list.created_at',
sort_order: 'desc',
...(filters.trim() !== '' ? { filter: filters } : {}),
};
Expand Down

0 comments on commit 8276afd

Please sign in to comment.