-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate legacy sort arrays on saved searches #43038
Conversation
Pinging @elastic/kibana-app |
💔 Build Failed |
@@ -29,24 +29,25 @@ function createSortObject(sortPair, indexPattern) { | |||
const [ field, direction ] = sortPair; | |||
return { [field]: direction }; | |||
} | |||
else if (_.isPlainObject(sortPair) && isSortable(Object.keys(sortPair)[0], indexPattern)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed a bug where getSort.array
was being used with an Elasticsearch formatted sort object but we weren't actually handling that in the getSort
code. So I updated this method to handle that case and added tests to make it more clear what all getSort.array
is expected to do.
💔 Build Failed |
💚 Build Succeeded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good. Unless I'm missing something, if someone fires up 7.4.0 and then uses one of the add sample data wizards, they will wind up with a saved search that has a sort that is only a 1 dimensional array. We should probably fix those as part of this PR too.
@bmcconaghy that should already be fixed, I updated the sample data files: https://github.com/elastic/kibana/pull/43038/files#diff-23e156bef21eddb8b1b0ea745bea791a Is there one I missed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM.
@Bargs nope I just missed your changes. |
💚 Build Succeeded |
With my multi sort PR I changed the sort property on saved searches to contain a nested array. Discover and Dashboard were backwards compatible with the old format but it turns out the nested array caused issues for CSV export. Instead of trying to support single and two dimension arrays everywhere, this PR simply adds a migration for saved searches in 7.4 and updates our sample data sets so that we can always expect sort objects to be two dimensional arrays. I also cleaned up the backwards compatibility code in Discover and Dashboard.
With my multi sort PR I changed the sort property on saved searches to contain a nested array. Discover and Dashboard were backwards compatible with the old format but it turns out the nested array caused issues for CSV export. Instead of trying to support single and two dimension arrays everywhere, this PR simply adds a migration for saved searches in 7.4 and updates our sample data sets so that we can always expect sort objects to be two dimensional arrays. I also cleaned up the backwards compatibility code in Discover and Dashboard.
Summary
Fixes #42982
With my multi sort PR I changed the sort property on saved searches to contain a nested array. Discover and Dashboard were backwards compatible with the old format but it turns out the nested array caused issues for CSV export. Instead of trying to support single and two dimension arrays everywhere, this PR simply adds a migration for saved searches in 7.4 and updates our sample data sets so that we can always expect sort objects to be two dimensional arrays. I also cleaned up the backwards compatibility code in Discover and Dashboard.
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.- [ ] This was checked for cross-browser compatibility, including a check against IE11- [ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support- [ ] Documentation was added for features that require explanation or tutorials- [ ] This was checked for keyboard-only and screenreader accessibilityFor maintainers
- [ ] This was checked for breaking API changes and was labeled appropriately- [ ] This includes a feature addition or change that requires a release note and was labeled appropriately