[8.16] Delete data when clearing security entity store (#197938) (#198017)

# Backport

This will backport the following commits from `main` to `8.16`:
- [Delete data when clearing security entity store
(#197938)](https://github.com/elastic/kibana/pull/197938)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Jared
Burgett","email":"147995946+jaredburgettelastic@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-10-28T14:59:01Z","message":"Delete
data when clearing security entity store (#197938)\n\n##
Summary\r\n\r\nFixed a bug where the \"Clear all entities\" button in
the security entity\r\nstore didn't delete data due to a missing query
parameter.","sha":"ffc88107f0f136481662f1fe3d1a19e23319eecd","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","v8.16.0","backport:version","v8.17.0"],"title":"Delete
data when clearing security entity
store","number":197938,"url":"https://github.com/elastic/kibana/pull/197938","mergeCommit":{"message":"Delete
data when clearing security entity store (#197938)\n\n##
Summary\r\n\r\nFixed a bug where the \"Clear all entities\" button in
the security entity\r\nstore didn't delete data due to a missing query
parameter.","sha":"ffc88107f0f136481662f1fe3d1a19e23319eecd"}},"sourceBranch":"main","suggestedTargetBranches":["8.16","8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/197938","number":197938,"mergeCommit":{"message":"Delete
data when clearing security entity store (#197938)\n\n##
Summary\r\n\r\nFixed a bug where the \"Clear all entities\" button in
the security entity\r\nstore didn't delete data due to a missing query
parameter.","sha":"ffc88107f0f136481662f1fe3d1a19e23319eecd"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Jared Burgett <147995946+jaredburgettelastic@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2024-10-29 03:45:32 +11:00 committed by GitHub
parent 90f85a27e6
commit ec81e460d6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View file

@ -43,9 +43,10 @@ export const useEntityStoreRoutes = () => {
});
};
const deleteEntityEngine = async (entityType: EntityType) => {
const deleteEntityEngine = async (entityType: EntityType, deleteData: boolean) => {
return http.fetch<DeleteEntityEngineResponse>(`/api/entity_store/engines/${entityType}`, {
method: 'DELETE',
query: { data: deleteData },
version: API_VERSIONS.public.v1,
});
};

View file

@ -110,7 +110,7 @@ export const useDeleteEntityEngineMutation = (options?: UseMutationOptions<{}>)
const invalidateEntityEngineStatusQuery = useInvalidateEntityEngineStatusQuery();
const { deleteEntityEngine } = useEntityStoreRoutes();
return useMutation<DeleteEntityEngineResponse[]>(
() => Promise.all([deleteEntityEngine('user'), deleteEntityEngine('host')]),
() => Promise.all([deleteEntityEngine('user', true), deleteEntityEngine('host', true)]),
{
...options,
mutationKey: DELETE_ENTITY_ENGINE_STATUS_KEY,