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

[UnifiedFieldList] Migrate field filters and field search from Lens #147255

Merged
merged 36 commits into from
Dec 20, 2022

Conversation

jughosta
Copy link
Contributor

@jughosta jughosta commented Dec 8, 2022

Closes #145089 and #147003

Summary

This PR migrates field filters and field search from Lens plugin to UnifiedFieldList plugin:

  • Move the components
  • Update design to add help elements and counters
  • Refactor Lens form_based and text_based views
  • Extend text_based view with search highlights and type filters
  • Refactor classes and data-test-subj
  • Unify field icon and field type label code and move to Unified Field List
  • Rename timeSeriesMetricType with timeSeriesMetric to be able to use this logic for both DataViewField and IndexPatternField
  • Migrate onFilterField logic to Unified Field List
  • Migrate availableFieldTypes logic to Unified Field List
  • Create a unified FieldList wrapper component
  • Update Lens tests if necessary
  • Add tests and docs

Screenshot 2022-12-16 at 19 11 14

Screenshot 2022-12-16 at 19 12 00

Checklist

@jughosta jughosta added release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. v8.7.0 labels Dec 8, 2022
@jughosta jughosta self-assigned this Dec 8, 2022
@jughosta jughosta changed the title [UnifiedFieldList] Migrate field filters and field search [UnifiedFieldList] Migrate field filters and field search from Lens Dec 16, 2022
@jughosta jughosta marked this pull request as ready for review December 16, 2022 19:59
@jughosta jughosta requested review from a team as code owners December 16, 2022 19:59
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

Copy link
Contributor

@andreadelrio andreadelrio left a comment

Choose a reason for hiding this comment

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

Sass changes LGTM.

@stratoula
Copy link
Contributor

@jughosta why can't I see the filters in Discover text based mode?
image

@stratoula
Copy link
Contributor

Also another thing I see
Why the agg field doesn't have an icon in Discover?
image

image

@jughosta
Copy link
Contributor Author

Hi @stratoula,
This PR is only extracting code from Lens to Unified Field List. In a follow up PR I will integrate it into Discover and address the mentioned differences. Thanks for your comments! 🙌

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.

Got it Julia! Visualizations team changes LGTM!

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, great refactoring, tests, and documentation. What a nice 🎁 for 🎄! Tested locally in Chrome, Firefox, Safari. Works as expected ✅

It might be worth adding information, that you can now search by text and keyword fields in Lens (Before it was "Text string")
And we might consider to handle _index as a keyword field?
Bildschirmfoto 2022-12-20 um 08 57 35
Unrelated to this PR, since it was already there, but does it make sense to filter by "Records"

src/plugins/unified_field_list/README.md Outdated Show resolved Hide resolved

function normalizeFieldType(type: string) {
if (type === 'histogram') {
// TODO: check why are we replacing this type
Copy link
Member

Choose a reason for hiding this comment

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

I assume because it's an array of numbers?

https://www.elastic.co/guide/en/elasticsearch/reference/current/histogram.html

A field to store pre-aggregated numerical data representing a histogram. This data is defined using two paired arrays:

  • A values array of double numbers, representing the buckets for the histogram. These values must be provided in ascending order.
  • A corresponding counts array of integer numbers, representing how many values fall into each bucket. These numbers must be positive or zero.

@@ -47,7 +47,7 @@ export function convertDataViewIntoLensIndexPattern(
customLabel: field.customLabel,
runtimeField: field.runtimeField,
runtime: Boolean(field.runtimeField),
timeSeriesMetricType: field.timeSeriesMetric,
timeSeriesMetric: field.timeSeriesMetric,
Copy link
Member

Choose a reason for hiding this comment

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

👍 for eye for details and consistency ... just saying!

@kertal kertal self-requested a review December 20, 2022 09:03
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
lens 890 887 -3
unifiedFieldList 51 83 +32
total +29

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 203 244 +41

Async chunks

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

id before after diff
discover 418.4KB 418.3KB -45.0B
lens 1.3MB 1.3MB -8.1KB
unifiedFieldList 38.1KB 48.4KB +10.4KB
total +2.2KB

Page load bundle

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

id before after diff
lens 30.5KB 30.5KB -1.0B
unifiedFieldList 23.7KB 36.2KB +12.4KB
total +12.4KB
Unknown metric groups

API count

id before after diff
unifiedFieldList 215 269 +54

async chunk count

id before after diff
unifiedFieldList 5 7 +2

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 61 67 +6
osquery 109 115 +6
securitySolution 439 445 +6
unifiedFieldList 15 17 +2
total +22

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
fleet 70 76 +6
osquery 110 117 +7
securitySolution 516 522 +6
unifiedFieldList 15 17 +2
total +23

History

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

cc @jughosta

@jughosta jughosta added the Feature:UnifiedFieldList The unified field list component used by Lens & Discover label Dec 20, 2022
@jughosta jughosta merged commit 5535dd1 into elastic:main Dec 20, 2022
jughosta added a commit that referenced this pull request Jan 16, 2023
A follow up for #147255
Copy is suggested by Gail.

<img width="614" alt="Screenshot 2023-01-16 at 12 52 23"
src="https://user-images.githubusercontent.com/1415710/212672146-ca3649d5-cb0d-42d3-b666-57ce51e09f29.png">

Co-authored-by: Kaarina Tungseth <[email protected]>
jughosta added a commit that referenced this pull request Jan 26, 2023
Closes #145081
Part 1 of this integration was done in
#147255

<img width="640" alt="Screenshot 2023-01-16 at 16 58 59"
src="https://user-images.githubusercontent.com/1415710/212720438-8f37eb69-635a-4611-89bb-34b095d79b8c.png">


## Summary

This PR integrates the unified field list filters and search into
Discover.
- [x] Integrate into Discover
- [x] Clean up deprecated code ("searchable"/"aggregatable" filters were
removed too)
- [x] Refactor field icons, labels, desc to use the unified ones
- [x] Field list in SQL view needs refactoring to use the received field
types rather than data view field types
- [x] Update tests

### 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: Kibana Machine <[email protected]>
Co-authored-by: Stratoula Kalafateli <[email protected]>
kqualters-elastic pushed a commit to kqualters-elastic/kibana that referenced this pull request Feb 6, 2023
…c#148547)

Closes elastic#145081
Part 1 of this integration was done in
elastic#147255

<img width="640" alt="Screenshot 2023-01-16 at 16 58 59"
src="https://user-images.githubusercontent.com/1415710/212720438-8f37eb69-635a-4611-89bb-34b095d79b8c.png">


## Summary

This PR integrates the unified field list filters and search into
Discover.
- [x] Integrate into Discover
- [x] Clean up deprecated code ("searchable"/"aggregatable" filters were
removed too)
- [x] Refactor field icons, labels, desc to use the unified ones
- [x] Field list in SQL view needs refactoring to use the received field
types rather than data view field types
- [x] Update tests

### 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: Kibana Machine <[email protected]>
Co-authored-by: Stratoula Kalafateli <[email protected]>
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:skip Skip the PR/issue when compiling release notes Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. v8.7.0
Projects
None yet
6 participants