Skip to content

Commit b8fa33b

Browse files
author
Liza K
committed
code review
1 parent ddd9222 commit b8fa33b

1 file changed

Lines changed: 18 additions & 23 deletions

File tree

src/core/server/ui_settings/saved_objects/migrations.ts

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,26 @@ import { SavedObjectUnsanitizedDoc, SavedObjectSanitizedDoc } from 'kibana/serve
1111
export const migrations = {
1212
'7.9.0': (doc: SavedObjectUnsanitizedDoc<any>): SavedObjectSanitizedDoc<any> => ({
1313
...doc,
14-
...(doc.attributes && {
15-
attributes: Object.keys(doc.attributes).reduce(
16-
(acc, key) =>
17-
key.startsWith('siem:')
18-
? {
19-
...acc,
20-
[key.replace('siem', 'securitySolution')]: doc.attributes[key],
21-
}
22-
: {
23-
...acc,
24-
[key]: doc.attributes[key],
25-
},
26-
{}
27-
),
28-
}),
2914
...(doc.attributes && {
3015
attributes: Object.keys(doc.attributes).reduce((acc, key) => {
31-
if (key === 'timepicker:quickRanges' && doc.attributes[key].indexOf('section') > -1) {
32-
const ranges = JSON.parse(doc.attributes[key]).map(({ from, to, display }) => {
33-
return {
34-
from,
35-
to,
36-
display,
37-
};
38-
});
16+
if (key.startsWith('siem:')) {
17+
return {
18+
...acc,
19+
[key.replace('siem', 'securitySolution')]: doc.attributes[key],
20+
};
21+
} else if (
22+
key === 'timepicker:quickRanges' &&
23+
doc.attributes[key].indexOf('section') > -1
24+
) {
25+
const ranges = JSON.parse(doc.attributes[key]).map(
26+
({ from, to, display }: { from: string; to: string; display: string }) => {
27+
return {
28+
from,
29+
to,
30+
display,
31+
};
32+
}
33+
);
3934
return {
4035
...acc,
4136
'timepicker:quickRanges': JSON.stringify(ranges, null, 2),

0 commit comments

Comments
 (0)