Skip to content

Commit

Permalink
Change into a 7.12 migration
Browse files Browse the repository at this point in the history
  • Loading branch information
Liza K committed Mar 4, 2021
1 parent b8fa33b commit d3ec0f5
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions src/core/server/ui_settings/saved_objects/migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,29 @@ import { SavedObjectUnsanitizedDoc, SavedObjectSanitizedDoc } from 'kibana/serve

export const migrations = {
'7.9.0': (doc: SavedObjectUnsanitizedDoc<any>): SavedObjectSanitizedDoc<any> => ({
...doc,
...(doc.attributes && {
attributes: Object.keys(doc.attributes).reduce(
(acc, key) =>
key.startsWith('siem:')
? {
...acc,
[key.replace('siem', 'securitySolution')]: doc.attributes[key],
}
: {
...acc,
[key]: doc.attributes[key],
},
{}
),
}),
references: doc.references || [],
}),
'7.12.0': (doc: SavedObjectUnsanitizedDoc<any>): SavedObjectSanitizedDoc<any> => ({
...doc,
...(doc.attributes && {
attributes: Object.keys(doc.attributes).reduce((acc, key) => {
if (key.startsWith('siem:')) {
return {
...acc,
[key.replace('siem', 'securitySolution')]: doc.attributes[key],
};
} else if (
key === 'timepicker:quickRanges' &&
doc.attributes[key].indexOf('section') > -1
) {
if (key === 'timepicker:quickRanges' && doc.attributes[key].indexOf('section') > -1) {
const ranges = JSON.parse(doc.attributes[key]).map(
({ from, to, display }: { from: string; to: string; display: string }) => {
return {
Expand Down

0 comments on commit d3ec0f5

Please sign in to comment.