[Security Solution][Exceptions] - Adds sort order for exception items (#76537)

## 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`
This commit is contained in:
Yara Tercero 2020-09-02 16:44:42 -04:00 committed by GitHub
parent aac84240b2
commit c46e77712a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View file

@ -375,6 +375,8 @@ describe('Exceptions Lists API', () => {
namespace_type: 'single,single',
page: '1',
per_page: '20',
sort_field: 'created_at',
sort_order: 'desc',
},
signal: abortCtrl.signal,
});
@ -406,6 +408,8 @@ describe('Exceptions Lists API', () => {
namespace_type: 'single',
page: '1',
per_page: '20',
sort_field: 'created_at',
sort_order: 'desc',
},
signal: abortCtrl.signal,
});
@ -437,6 +441,8 @@ describe('Exceptions Lists API', () => {
namespace_type: 'agnostic',
page: '1',
per_page: '20',
sort_field: 'created_at',
sort_order: 'desc',
},
signal: abortCtrl.signal,
});
@ -468,6 +474,8 @@ describe('Exceptions Lists API', () => {
namespace_type: 'agnostic',
page: '1',
per_page: '20',
sort_field: 'created_at',
sort_order: 'desc',
},
signal: abortCtrl.signal,
});
@ -500,6 +508,8 @@ describe('Exceptions Lists API', () => {
namespace_type: 'agnostic',
page: '1',
per_page: '20',
sort_field: 'created_at',
sort_order: 'desc',
},
signal: abortCtrl.signal,
});

View file

@ -288,6 +288,8 @@ 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_order: 'desc',
...(filters.trim() !== '' ? { filter: filters } : {}),
};
const [validatedRequest, errorsRequest] = validate(query, findExceptionListItemSchema);