Skip to content

Commit

Permalink
[Security Solution][Exceptions] - Adds sort order for exception items (
Browse files Browse the repository at this point in the history
…#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`
  • Loading branch information
yctercero authored Sep 3, 2020
1 parent 8e88729 commit a34b0a2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions x-pack/plugins/lists/public/exceptions/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down Expand Up @@ -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,
});
Expand Down Expand Up @@ -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,
});
Expand Down Expand Up @@ -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,
});
Expand Down Expand Up @@ -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,
});
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/lists/public/exceptions/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a34b0a2

Please sign in to comment.