Skip to content

Commit 8276afd

Browse files
authored
[Security Solution][Exceptions] - Updates exception item find sort field (#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" ```
1 parent d2156b7 commit 8276afd

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

x-pack/plugins/lists/public/exceptions/api.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ describe('Exceptions Lists API', () => {
375375
namespace_type: 'single,single',
376376
page: '1',
377377
per_page: '20',
378-
sort_field: 'created_at',
378+
sort_field: 'exception-list.created_at',
379379
sort_order: 'desc',
380380
},
381381
signal: abortCtrl.signal,
@@ -408,7 +408,7 @@ describe('Exceptions Lists API', () => {
408408
namespace_type: 'single',
409409
page: '1',
410410
per_page: '20',
411-
sort_field: 'created_at',
411+
sort_field: 'exception-list.created_at',
412412
sort_order: 'desc',
413413
},
414414
signal: abortCtrl.signal,
@@ -441,7 +441,7 @@ describe('Exceptions Lists API', () => {
441441
namespace_type: 'agnostic',
442442
page: '1',
443443
per_page: '20',
444-
sort_field: 'created_at',
444+
sort_field: 'exception-list.created_at',
445445
sort_order: 'desc',
446446
},
447447
signal: abortCtrl.signal,
@@ -474,7 +474,7 @@ describe('Exceptions Lists API', () => {
474474
namespace_type: 'agnostic',
475475
page: '1',
476476
per_page: '20',
477-
sort_field: 'created_at',
477+
sort_field: 'exception-list.created_at',
478478
sort_order: 'desc',
479479
},
480480
signal: abortCtrl.signal,
@@ -508,7 +508,7 @@ describe('Exceptions Lists API', () => {
508508
namespace_type: 'agnostic',
509509
page: '1',
510510
per_page: '20',
511-
sort_field: 'created_at',
511+
sort_field: 'exception-list.created_at',
512512
sort_order: 'desc',
513513
},
514514
signal: abortCtrl.signal,

x-pack/plugins/lists/public/exceptions/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ export const fetchExceptionListsItemsByListIds = async ({
288288
namespace_type: namespaceTypes.join(','),
289289
page: pagination.page ? `${pagination.page}` : '1',
290290
per_page: pagination.perPage ? `${pagination.perPage}` : '20',
291-
sort_field: 'created_at',
291+
sort_field: 'exception-list.created_at',
292292
sort_order: 'desc',
293293
...(filters.trim() !== '' ? { filter: filters } : {}),
294294
};

0 commit comments

Comments
 (0)