-
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
Allow sorting on multiple columns in Discover #41918
Conversation
Pinging @elastic/kibana-app |
@AlonaNadler @timroes I've submitted a PR with the old work I mentioned during our meeting today. |
💔 Build Failed |
💔 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.
Code looks good.
I tested this in Chrome and Safari and it works as expected.
In addition, I tested an imported saved search and the sort order was maintained.
A few small things:
- I keep expecting the sort order to be maintained in the order in which I added the sort (first one most important and the orders being inner/nested sorting fields). We might want to consider adding some visual indicator of the sorting precedence later on.
- The icons are really small and it would be nice to make them more obvious at a later stage but that requires more real estate in table headers.
# Conflicts: # src/legacy/core_plugins/kibana/public/discover/doc_table/__tests__/lib/rows_headers.js # src/legacy/core_plugins/kibana/public/discover/doc_table/components/table_header.js
Hold off on review, need to resolve conflicts caused by #41259 |
Alright, conflicts are resolved and this is ready for review again. @TinaHeiligers would you mind rechecking? I basically had to reimplement the multi-sort UI in the new react table header so I think it's worth another look. |
💔 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.
Code LGTM.
Tested in Chrome, Safari and Firefox. All still works as expected!
const btnSortClassName = | ||
sortDirection !== '' ? btnSortIcon : `kbnDocTableHeader__sortChange ${btnSortIcon}`; | ||
|
||
const handleChangeSortOrder = () => { | ||
// Cycle goes Unsorted -> Asc -> Desc -> Unsorted |
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.
The sort order cycle is not obvious in the UI. Perhaps we should consider adding a tooltip or some other indicator of what the cycle is.
I don't think we should invest too much time into gold plating the UI since the doc table will be rewritten soon anyway. I think the pattern I've implemented is pretty standard in most software. Click once, sort in one direction, click a second time, sort in the other direction, click again and it removes the sort. This popular table component does the same thing. The only difference is that it requires the user to hold |
💚 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.
Code LGTM, tested locally in Chrome, I think also @elastic/kibana-design should take a look at it because of UI & usability and the transformation to the new grid component. I think we should align this intermediate step
Here's a quick suggestion how we could display the sorted fields in the current layout, also it would allow an easier removal of sorted fields: It would add information about the order of the sorted fields, also you would see, if you click 5 different fields without removing one, that you're build up a kind of sorted fields stack (maybe we should also limit the number of fields you can sort by) |
I'll start this up and take a quick look. I get where @Bargs is coming from and, as long as it fits common UI interaction patterns, then it seems a valuable (small, yet impactful) change that need not get bogged down by too much UI work at this stage. |
Here are a few (hopefully small) things I would recommend changing:
For future reference, we may be heading towards a more robust search that looks something like these examples, both of which also keep the initial sort the top priority: Airtable sortingGoogle Sheets sorting |
@ryankeairns "For future reference, we may be heading towards a more robust search that looks something like these examples, both of which also keep the initial sort the top priority" it might be a weird kind of i18n or that my morning caffein doesn't work, but I've got the impression, that in case of Airtable, always the latest click gets highest priority? |
Thanks for the suggestions @ryankeairns, I think they're all good ones and I've implemented them all.
|
💚 Build Succeeded |
This commit enables sorting on multiple columns in Discover and in saved search panels on dashboards. The UI is simple and should be familiar based on the way multi-sort works in other common applications like file explorers. Each sortable column has a sort icon indicating which way it is sorted (or unsorted, in the case of two arrows pointing both up and down). Sort priority is determined by which column was clicked most recently, with the most recent being the lowest priority.
…-or-edit-existing-rollup-job * 'master' of github.com:elastic/kibana: (67 commits) [TSVB] Shim new platform (elastic#39169) [Metric Vis] Shim new platform (elastic#42240) [Tag Cloud] Shim new platform (elastic#42348) Disable flaky request lib tests. Add es_ui_shared plugin to CODEOWNERS. Add disk space percentage to node listing (elastic#42145) [SIEM] Add chart interactions - update date picker after brush selection on charts (elastic#42440) Document HTTP service (elastic#42331) [Reporting] Sanitize 409 error log message (elastic#42495) [docs][skip ci] Maps read only access (elastic#35561) [x-pack/ftr] refactor types to be more accurate/consistent wit… (elastic#42407) [DOCS] Updates images and content in Dashboard docs (elastic#42500) Allow sorting on multiple columns in Discover (elastic#41918) [Infra UI][Logs UI] Fix autocomplete to use proper derived index pattern (elastic#42287) [ftr/cheerio] improve cheerio types to include test subject me… (elastic#42534) Upgraded EUI 13.0.0 -> 13.1.1 (elastic#42298) Increase max-old-space-size for builds (elastic#42218) [Infra UI] Add cloud metrics and cloud/host info to metadata endpoint (elastic#41836) [Logs UI][a11y] Announce name of column on remove column button (elastic#41695) Inspector 👉 New Platform (elastic#42164) Make alerting properly space aware (elastic#42081) ...
…s_autocomplete * 'master' of github.com:elastic/kibana: (189 commits) [TSVB] Shim new platform (elastic#39169) [Metric Vis] Shim new platform (elastic#42240) [Tag Cloud] Shim new platform (elastic#42348) Disable flaky request lib tests. Add es_ui_shared plugin to CODEOWNERS. Add disk space percentage to node listing (elastic#42145) [SIEM] Add chart interactions - update date picker after brush selection on charts (elastic#42440) Document HTTP service (elastic#42331) [Reporting] Sanitize 409 error log message (elastic#42495) [docs][skip ci] Maps read only access (elastic#35561) [x-pack/ftr] refactor types to be more accurate/consistent wit… (elastic#42407) [DOCS] Updates images and content in Dashboard docs (elastic#42500) Allow sorting on multiple columns in Discover (elastic#41918) [Infra UI][Logs UI] Fix autocomplete to use proper derived index pattern (elastic#42287) [ftr/cheerio] improve cheerio types to include test subject me… (elastic#42534) Upgraded EUI 13.0.0 -> 13.1.1 (elastic#42298) Increase max-old-space-size for builds (elastic#42218) [Infra UI] Add cloud metrics and cloud/host info to metadata endpoint (elastic#41836) [Logs UI][a11y] Announce name of column on remove column button (elastic#41695) Inspector 👉 New Platform (elastic#42164) Make alerting properly space aware (elastic#42081) ...
This commit enables sorting on multiple columns in Discover and in saved search panels on dashboards. The UI is simple and should be familiar based on the way multi-sort works in other common applications like file explorers. Each sortable column has a sort icon indicating which way it is sorted (or unsorted, in the case of two arrows pointing both up and down). Sort priority is determined by which column was clicked most recently, with the most recent being the lowest priority.
Hello, from which release of Kibana is this feature available? |
@darshakkakkad released with |
Summary
Fixes #696
I took a crack at this previously and got pretty far, the only thing that blocked me was #16324. Lukas took over that PR and finished it in #33453. So I dug up my old work and merged in the latest from master. After some quick testing everything seems to be working so I'm submitting this PR.
This commit enables sorting on multiple columns in Discover and in saved search panels on dashboards. The UI is simple and should be familiar based on the way multi-sort works in other common applications like file explorers. Each sortable column has a sort icon indicating which way it is sorted (or unsorted, in the case of two arrows pointing both up and down). Sort priority is determined by which column was clicked most recently, with the most recent being the lowest priority.
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 tutorialsFor maintainers
- [ ] This was checked for breaking API changes and was labeled appropriately