Skip to content

Commit

Permalink
[Bug] missing timepicker:quickRanges migration (elastic#93409)
Browse files Browse the repository at this point in the history
* timepicker:quickRanges

* code review

* Change into a 7.12 migration
# Conflicts:
#	src/core/server/ui_settings/saved_objects/migrations.ts
  • Loading branch information
lizozom authored and Liza K committed Mar 11, 2021
1 parent 11f4ea8 commit 2f0b467
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions src/core/server/ui_settings/saved_objects/migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,51 @@ export const migrations = {
}),
references: doc.references || [],
}),
'7.12.0': (doc: SavedObjectUnsanitizedDoc<any>): SavedObjectSanitizedDoc<any> => ({
...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<any>): SavedObjectSanitizedDoc<any> => ({
...doc,
...(doc.attributes && {
attributes: Object.keys(doc.attributes).reduce(
(acc, key) =>
key === 'ml:fileDataVisualizerMaxFileSize'
? {
...acc,
['fileUpload:maxFileSize']: doc.attributes[key],
}
: {
...acc,
[key]: doc.attributes[key],
},
{}
),
}),
references: doc.references || [],
}),
};

0 comments on commit 2f0b467

Please sign in to comment.