Skip to content

Commit

Permalink
timepicker:quickRanges
Browse files Browse the repository at this point in the history
  • Loading branch information
Liza K committed Mar 3, 2021
1 parent be0b444 commit ddd9222
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/core/server/ui_settings/saved_objects/migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,28 @@ export const migrations = {
{}
),
}),
...(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 }) => {
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<any>): SavedObjectSanitizedDoc<any> => ({
Expand Down

0 comments on commit ddd9222

Please sign in to comment.