[8.6] Remove id from item list (#146805) (#147033)

# Backport

This will backport the following commits from `main` to `8.6`:
- [Remove id from item list
(#146805)](https://github.com/elastic/kibana/pull/146805)

<!--- Backport version: 8.9.7 -->

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

<!--BACKPORT [{"author":{"name":"Khristinin
Nikita","email":"nikita.khristinin@elastic.co"},"sourceCommit":{"committedDate":"2022-12-05T18:01:02Z","message":"Remove
id from item list (#146805)\n\n## Remove id from item list when try to
close alerts during update\r\nexceptions\r\nclose:
https://github.com/elastic/kibana/issues/146661\r\n\r\nCo-authored-by:
Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"7261175571b0bcfd68c538067c60eac12dad84e1","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","backport:prev-minor","v8.7.0"],"number":146805,"url":"https://github.com/elastic/kibana/pull/146805","mergeCommit":{"message":"Remove
id from item list (#146805)\n\n## Remove id from item list when try to
close alerts during update\r\nexceptions\r\nclose:
https://github.com/elastic/kibana/issues/146661\r\n\r\nCo-authored-by:
Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"7261175571b0bcfd68c538067c60eac12dad84e1"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/146805","number":146805,"mergeCommit":{"message":"Remove
id from item list (#146805)\n\n## Remove id from item list when try to
close alerts during update\r\nexceptions\r\nclose:
https://github.com/elastic/kibana/issues/146661\r\n\r\nCo-authored-by:
Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"7261175571b0bcfd68c538067c60eac12dad84e1"}}]}]
BACKPORT-->

Co-authored-by: Khristinin Nikita <nikita.khristinin@elastic.co>
This commit is contained in:
Kibana Machine 2022-12-05 14:33:45 -05:00 committed by GitHub
parent a91d495b66
commit 9b8e563574
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,7 +8,7 @@
import React from 'react';
import type { EuiCommentProps } from '@elastic/eui';
import { EuiText, EuiAvatar } from '@elastic/eui';
import { capitalize } from 'lodash';
import { capitalize, omit } from 'lodash';
import moment from 'moment';
import type {
@ -143,11 +143,12 @@ export const prepareExceptionItemsForBulkClose = (
return exceptionItems.map((item: ExceptionListItemSchema) => {
if (item.entries !== undefined) {
const newEntries = item.entries.map((itemEntry: Entry | EntryNested) => {
const entry = omit(itemEntry, 'id') as Entry | EntryNested;
return {
...itemEntry,
field: itemEntry.field.startsWith('event.')
? itemEntry.field.replace(/^event./, `${ALERT_ORIGINAL_EVENT}.`)
: itemEntry.field,
...entry,
field: entry.field.startsWith('event.')
? entry.field.replace(/^event./, `${ALERT_ORIGINAL_EVENT}.`)
: entry.field,
};
});
return {