Skip to content

Commit a34b0a2

Browse files
authored
[Security Solution][Exceptions] - Adds sort order for exception items (#76537) (#76567)
## Summary **Components affected:** ExceptionsViewer **Current behavior:** - when a user edits an exception item, the order of the exception items in the viewer changes. This creates confusion and looks like updates weren't applied (even though they were, just item order changed) **New behavior:** - when a user edits an exception item, the order of the exception items in the viewer don't change. Sort order is now based on `created_at`
1 parent 8e88729 commit a34b0a2

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ describe('Exceptions Lists API', () => {
375375
namespace_type: 'single,single',
376376
page: '1',
377377
per_page: '20',
378+
sort_field: 'created_at',
379+
sort_order: 'desc',
378380
},
379381
signal: abortCtrl.signal,
380382
});
@@ -406,6 +408,8 @@ describe('Exceptions Lists API', () => {
406408
namespace_type: 'single',
407409
page: '1',
408410
per_page: '20',
411+
sort_field: 'created_at',
412+
sort_order: 'desc',
409413
},
410414
signal: abortCtrl.signal,
411415
});
@@ -437,6 +441,8 @@ describe('Exceptions Lists API', () => {
437441
namespace_type: 'agnostic',
438442
page: '1',
439443
per_page: '20',
444+
sort_field: 'created_at',
445+
sort_order: 'desc',
440446
},
441447
signal: abortCtrl.signal,
442448
});
@@ -468,6 +474,8 @@ describe('Exceptions Lists API', () => {
468474
namespace_type: 'agnostic',
469475
page: '1',
470476
per_page: '20',
477+
sort_field: 'created_at',
478+
sort_order: 'desc',
471479
},
472480
signal: abortCtrl.signal,
473481
});
@@ -500,6 +508,8 @@ describe('Exceptions Lists API', () => {
500508
namespace_type: 'agnostic',
501509
page: '1',
502510
per_page: '20',
511+
sort_field: 'created_at',
512+
sort_order: 'desc',
503513
},
504514
signal: abortCtrl.signal,
505515
});

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,8 @@ 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',
292+
sort_order: 'desc',
291293
...(filters.trim() !== '' ? { filter: filters } : {}),
292294
};
293295
const [validatedRequest, errorsRequest] = validate(query, findExceptionListItemSchema);

0 commit comments

Comments
 (0)