Skip to content
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

[Discover][UnifiedFieldList] Integrate unified field list sections into Discover #144412

Conversation

jughosta
Copy link
Contributor

@jughosta jughosta commented Nov 2, 2022

Closes #135678

Summary

This PR continues the work started in #142758 to bring field list grouping from Lens into Discover.

  • Integrate new components and hooks into Discover page
  • Refactor fields grouping logic
  • Render Popular fields under a new separate section
  • Remove "Hide empty fields" switch
  • Adjust filtering logic
  • Refactor fields existence logic in Discover
  • Add "Unmapped fields" section
  • Highlight the matching term when searching for a field
  • Show field icons when in SQL mode
  • Add tooltips to field list section headings
  • Add tests, clean up

Screenshot 2022-11-15 at 15 39 27

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

[Discover] Start integrating the new grouped field list

[Discover] Render selected fields too

[Discover] Remove "Hide empty fields" toggle

[Discover] Show popular fields

[Discover] Refactor selected fields

[Discover] Refactor general grouping

[Discover] Update tests

[Discover] Update tests and fix some issues

[Discover] Update accordion tooltip and fix flags

[Discover] Show loading indicators

[Discover] Fix stuck field buttons for text-based queries

[Discover] Add field search highlights

[Discover] Fix Discover icons for meta fields

[Discover] Restore icons for text-based queries

[Discover] Update tests

[Discover] Handle edge cases

[Discover] Update tests

[Discover] Update tests

[Discover] Update tests

[Discover] Update tests
@jughosta jughosta added release_note:enhancement backport:skip This commit does not require backporting Team:DataDiscovery Discover App Team (Document Explorer, Saved Search, Surrounding documents, Graph) v8.6.0 Feature:UnifiedFieldList The unified field list component used by Lens & Discover labels Nov 2, 2022
@jughosta jughosta self-assigned this Nov 2, 2022
Copy link
Member

@kertal kertal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a big PR, lots of nice stuff under the hood 👍 , providing quick feedback
As synced offline

  • when switching data view, the sections showing the �ields should be cleaned up
  • the initial state of the sections is showing a loading spinner, when discover:searchOnPageLoad is set to Off

Copy link
Member

@kertal kertal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM, tested it again, and it works as expected. Lots of work, great work, congrats!

Copy link
Contributor

@davismcphee davismcphee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow awesome work! The code looks great, lots of nice cleanup, and plenty of tests 👍 I left a couple small nits and questions/comments, but I didn't see anything I'd consider a blocker. I still have to finish my local testing in the morning, and I'll do another quick pass at the code, but overall this is looking really good.

Copy link
Contributor

@davismcphee davismcphee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the latest updates! I finished my local testing today, and it seems to be working great. It's a big step forward in consistency between Discover and Lens, and some of the more subtle changes like field highlighting add polish 👌. Also the testing list was super convenient to help test thoroughly. There's only one thing I saw that I think is a bug, and two questions I have:

I noticed that when discover:searchOnPageLoad is false, if I open a saved search and then click 'New', the fields remain in the sidebar when they used to get cleared out:
no_load_on_search

It looks like it used to be that multifields couldn't become popular, but now they can. Is this something we did intentionally?

Old:
popular_multi_old

New:
popular_multi_new

And last, I just wanted to check that I understand this point correctly:

discover:searchFieldsFromSource should show multifields right in the fields list if enabled

This is new, correct? And it's the reason why I now see the .keyword fields directly in the list when discover:searchFieldsFromSource is true?
searchFieldsFromSource_new

@jughosta
Copy link
Contributor Author

@davismcphee Good catch! Fixed all.

Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great Julia! I was mostly focused on Lens, I tested it with various dataviews for both modes. Visualizations changes LGTM!

Copy link
Contributor

@davismcphee davismcphee left a 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 review again, thanks for fixing those issues!

I did a final round of testing today and the only thing I encountered was that when I created a new field with no value, it now appears in available fields instead of empty fields. In my local main build, it seems that empty runtime fields are only shown when 'Hide empty fields' is off:
empty_field

With that said, I consider this a minor non-blocker issue, so I'll leave it up to you to add the fix to this PR or create a small followup issue to fix once merged. Otherwise this LGTM! Great work on this and I'm excited to see it merged soon 🥳

@jughosta
Copy link
Contributor Author

jughosta commented Dec 1, 2022

Thanks for all the reviews!

@davismcphee Let's discuss it during our next meeting. There was an agreement that runtime fields should be always available.

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
discover 448 446 -2
unifiedFieldList 50 51 +1
total -1

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
unifiedFieldList 192 203 +11

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
discover 415.3KB 413.7KB -1.6KB
lens 1.3MB 1.3MB -272.0B
unifiedFieldList 37.1KB 38.1KB +1013.0B
total -882.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
unifiedFieldList 21.5KB 23.7KB +2.2KB
Unknown metric groups

API count

id before after diff
unifiedFieldList 203 215 +12

ESLint disabled in files

id before after diff
osquery 1 2 +1

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
fleet 59 65 +6
osquery 109 115 +6
securitySolution 442 448 +6
unifiedFieldList 14 15 +1
total +21

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
fleet 68 74 +6
osquery 110 117 +7
securitySolution 519 525 +6
unifiedFieldList 14 15 +1
total +22

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @jughosta

@jughosta jughosta merged commit 66718fc into elastic:main Dec 1, 2022
@jughosta jughosta deleted the 135678-unified-field-list-sections-in-discover-2 branch December 1, 2022 14:02
jughosta added a commit that referenced this pull request Dec 8, 2022
)

This is a follow up PR for #144412
to fix how "Error" case is handled.

Before: the sidebar was stuck in loading state:
<img width="600" alt="Screenshot 2022-12-07 at 13 16 21"
src="https://user-images.githubusercontent.com/1415710/206183995-9079ee4f-6c7c-4a59-ace3-f2c22807a17b.png">

After: the sidebar is rendered:
<img width="600" alt="Screenshot 2022-12-07 at 13 17 06"
src="https://user-images.githubusercontent.com/1415710/206184115-abd08241-e0b6-4fff-b257-fe12be2a0006.png">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:UnifiedFieldList The unified field list component used by Lens & Discover release_note:enhancement Team:DataDiscovery Discover App Team (Document Explorer, Saved Search, Surrounding documents, Graph) v8.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Discover] Field List - refactor sections to align with Lens implementation