mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
* [Bug] missing timepicker:quickRanges migration (#93409) * timepicker:quickRanges * code review * Change into a 7.12 migration # Conflicts: # src/core/server/ui_settings/saved_objects/migrations.ts * Delete migration Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
4fa13de239
commit
338916c3e4
1 changed files with 28 additions and 0 deletions
|
@ -28,4 +28,32 @@ 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 || [],
|
||||
}),
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue