diff --git a/src/core/server/ui_settings/saved_objects/migrations.ts b/src/core/server/ui_settings/saved_objects/migrations.ts index b5dc13fcdae3b2..16f217352b99a7 100644 --- a/src/core/server/ui_settings/saved_objects/migrations.ts +++ b/src/core/server/ui_settings/saved_objects/migrations.ts @@ -28,6 +28,34 @@ export const migrations = { }), references: doc.references || [], }), + '7.12.0': (doc: SavedObjectUnsanitizedDoc): SavedObjectSanitizedDoc => ({ + ...doc, + ...(doc.attributes && { + attributes: Object.keys(doc.attributes).reduce((acc, key) => { + 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 { + from, + to, + display, + }; + } + ); + return { + ...acc, + 'timepicker:quickRanges': JSON.stringify(ranges, null, 2), + }; + } else { + return { + ...acc, + [key]: doc.attributes[key], + }; + } + }, {}), + }), + references: doc.references || [], + }), '7.13.0': (doc: SavedObjectUnsanitizedDoc): SavedObjectSanitizedDoc => ({ ...doc, ...(doc.attributes && {