-
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
[UnifiedFieldList] Migrate field list components from Lens to UnifiedFieldList #142758
[UnifiedFieldList] Migrate field list components from Lens to UnifiedFieldList #142758
Conversation
…d-list-sections # Conflicts: # x-pack/plugins/lens/public/indexpattern_datasource/datapanel.tsx
…d-list-sections # Conflicts: # src/plugins/unified_field_list/public/components/field_list/field_list_grouped.scss # src/plugins/unified_field_list/public/components/field_list/fields_accordion.tsx # src/plugins/unified_field_list/public/components/field_list/no_fields_callout.test.tsx # src/plugins/unified_field_list/public/components/field_list/no_fields_callout.tsx # x-pack/plugins/lens/public/data_views_service/loader.test.ts # x-pack/plugins/lens/public/data_views_service/loader.ts # x-pack/plugins/lens/public/datasources/form_based/datapanel.test.tsx # x-pack/plugins/lens/public/datasources/form_based/datapanel.tsx # x-pack/plugins/lens/public/datasources/form_based/dimension_panel/dimension_panel.test.tsx # x-pack/plugins/lens/public/datasources/form_based/dimension_panel/field_input.test.tsx # x-pack/plugins/lens/public/datasources/form_based/dimension_panel/field_select.tsx # x-pack/plugins/lens/public/datasources/form_based/dimension_panel/reference_editor.tsx # x-pack/plugins/lens/public/datasources/form_based/field_list.scss # x-pack/plugins/lens/public/datasources/form_based/field_list.tsx # x-pack/plugins/lens/public/datasources/form_based/fields_accordion.test.tsx # x-pack/plugins/lens/public/datasources/form_based/fields_accordion.tsx # x-pack/plugins/lens/public/datasources/form_based/no_fields_callout.test.tsx # x-pack/plugins/lens/public/datasources/form_based/no_fields_callout.tsx # x-pack/plugins/lens/public/datasources/form_based/operations/definitions/index.ts # x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/field_inputs.tsx # x-pack/plugins/lens/public/indexpattern_datasource/field_list.scss # x-pack/plugins/lens/public/indexpattern_datasource/fields_accordion.tsx # x-pack/plugins/lens/public/indexpattern_datasource/no_fields_callout.test.tsx # x-pack/plugins/lens/public/indexpattern_datasource/no_fields_callout.tsx
@dej611 Updated. Thanks for reviewing the PR! |
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.
Finished my code review and it looks great 👍 The documentation is nice to have and lots of test coverage is always good. I left a few questions and comments, and I still have to do some more local testing to do, but it LGTM so far.
src/plugins/unified_field_list/public/components/field_list/field_list_grouped.tsx
Outdated
Show resolved
Hide resolved
src/plugins/unified_field_list/public/hooks/use_existing_fields.ts
Outdated
Show resolved
Hide resolved
src/plugins/unified_field_list/public/hooks/use_grouped_fields.ts
Outdated
Show resolved
Hide resolved
isAffectedByGlobalFilter: false, | ||
isAffectedByTimeFilter: true, | ||
// Show details on timeout but not failure | ||
// hideDetails: fieldsExistenceInfoUnavailable && !existenceFetchTimeout, // TODO: is this check still necessary? |
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.
Do we know if this is necessary now or do we possibly need input from the Lens team?
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 question is how to catch timeouts of loadFieldExisting
after it was moved from Lens server API to public of unifiedFieldList plugin in #139453. It might be not relevant anymore.
cc @dimaanj
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 also think that this is no longer necessary since dataViewsService getFieldsForIndexPattern
doesn't support a dedicated timeout error state, right @mattkime ?
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 got a chance to finish my local testing today and if there are issues, I can't find them at least 👍 Everything worked great and I didn't encounter anything that seemed like a bug to me.
The only thing I noticed that seemed a little strange was that once I added a field to my vis, the plus button in its popover became disabled and the tooltip description didn't seem correct:
This isn't a blocker to me though (and it might have already worked that way in Lens), but I wonder if doing something like switching the plus button to a minus when the field is selected would be more helpful to a user instead:
Other than that, this LGTM as soon as we get the lastFetchRequestedAtTimestamp
concerns sorted out.
…d-list-sections # Conflicts: # x-pack/plugins/lens/public/datasources/text_based/fields_accordion.tsx
@elasticmachine merge upstream |
@davismcphee I think the behaviour of "+" button becoming disabled in the popover for a selected field is correct. It's the same on the main branch and the tooltip is the same. |
…r will have their own tooltips.
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.
Thanks for the updates! I did a final round of testing and code review, and it LGTM 🎉 It seems like there might still be a couple outstanding questions in the comments before we hit the button, but on my end this seems ready to merge. I'm excited to see this implemented in Discover too 🙂
I think the behaviour of "+" button becoming disabled in the popover for a selected field is correct. It's the same on the main branch and the tooltip is the same.
Thanks for checking that for me, and it's good to know the behaviour is the same as before. I probably should have written "I think disabling the button and keeping the tooltip isn't a great UX" instead, but that's not something for this PR to address anyway.
Hi @elastic/kibana-vis-editors, |
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 works fine Julia! I can't find any regression on functionality or performance. Thanx for working on that :) LGTM
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Public APIs missing exports
Page load bundle
Unknown metric groupsAPI count
async chunk count
ESLint disabled in files
ESLint disabled line counts
References to deprecated APIs
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @jughosta |
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.
Tested again in Safari and found no new bugs from main
👍
…to Discover (#144412) Closes #135678 ## Summary This PR continues the work started in #142758 to bring field list grouping from Lens into Discover. - [x] Integrate new components and hooks into Discover page - [x] Refactor fields grouping logic - [x] Render Popular fields under a new separate section - [x] Remove "Hide empty fields" switch - [x] Adjust filtering logic - [x] Refactor fields existence logic in Discover - [x] Add "Unmapped fields" section - [x] Highlight the matching term when searching for a field - [x] Show field icons when in SQL mode - [x] Add tooltips to field list section headings - [x] Add tests, clean up <img width="340" alt="Screenshot 2022-11-15 at 15 39 27" src="https://user-images.githubusercontent.com/1415710/201947349-726ffc3a-a17f-411b-be92-81d97879765a.png"> For testing on Discover page: Please check different use cases and toggling Advanced Settings: - regular vs ad-hoc data views - data views with and without a time field - data views with unmapped and empty fields - data views with a lot of fields - data views with some fields being filtered out via data view configuration - updating query, filters, and time range - regular and SQL mode - searching by a field name in the sidebar - applying a field filter in the sidebar - adding, editing, and removing a field - Field Statistics table when some columns are selected or no columns are selected - multifields in the field popover should work as before (icon should change from "+" to "x" when subfield is selected as a column) - `discover:searchOnPageLoad` should not show fields if turned off - `discover:searchFieldsFromSource` should show multifields right in the fields list if enabled - `discover:enableSql` should show Selected and Available fields only when enabled - `discover:showLegacyFieldTopValues` should show old (green) field stats in its popover - `doc_table:legacy` On Lens page: - scroll position should reset when data view is switched or when searching by a field name - regular and SQL mode ### Checklist - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [x] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) Co-authored-by: Michael Marcialis <[email protected]> Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Stratoula Kalafateli <[email protected]>
Addresses #135678
Summary
This PR migrates components/logic from Lens to UnifiedFieldList. There should be no visual changes at this point.
useExistingFieldsFetcher
for fetching fields existence data. A separate hookuseExistingFieldsReader
will be used for reading the fetched data in children components (instead of reading from Lens redux state).useGroupedFields
hook for grouping a fields list into sectionsAs our next step we integrate them into Discover page.
Notes for testing:
Please test field list on Lens page. It should behave as before for regular/ad-hoc data views and for text-based queries. Fields existence data was removed from Lens redux store and the layers panel now uses
useExistingFieldsReader
hook to get the existence data - please check that ui controls work as before. Please also check that the performance of the sidebar with a lot of fields was not affected.Checklist