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] Implement ad-hoc data views #138283

Merged
merged 65 commits into from
Sep 14, 2022

Conversation

dimaanj
Copy link
Contributor

@dimaanj dimaanj commented Aug 8, 2022

Summary

Closes #137671

This PR enables basic hoc Data Views experience. When action needs persisted data view, the following prompt will be shown.

Actions which need persistence of data view currently:

  • Creating an alert
  • Share
  • Visualise geo fields

E934D65F-EE40-45EF-886C-A10A7D9B42A9_4_5005_c

Discover Alerts, Share, navigation from lens and adding multiple adhoc data views will be implemented in follow up #139984

How to test

  • Open data view management from discover
  • Give a name k* and select timestamp field timefield to see documents from flights and logs sample data
  • Click Use without saving

B6176AC2-FBE4-4F36-B243-653A7A60A03C_1_201_a

Checklist

@dimaanj dimaanj added release_note:enhancement Feature:Discover Discover Application Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. v8.5.0 labels Aug 8, 2022
@dimaanj dimaanj self-assigned this Aug 8, 2022
@dimaanj
Copy link
Contributor Author

dimaanj commented Aug 11, 2022

@elasticmachine merge upstream

@dimaanj dimaanj marked this pull request as ready for review August 11, 2022 15:14
@dimaanj dimaanj requested a review from a team as a code owner August 11, 2022 15:14
@elasticmachine
Copy link
Contributor

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

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.

I'm excited to have this finally in Discover soon. It's one of the things I wanted to have when I first played with it, more than 5 years ago!

Been playing around with it and this are my first comments

  • Sharing needs a persisted data view
  • Field statistics doesn't need a persisted one, that's a pleasant surprise, however the Lens button in needs it, so for now till Lens supports the ad hoc ones, I'd suggest to disable field statistics, because I think the effort to pass the check for persistence down might be to high
  • We should cover the new functionality with a functional
  • We need some fine words, and adding @gchaps for this purpose

So when users decides to create a data view without saving

Bildschirmfoto 2022-08-11 um 17 52 19

They get prompted if an action requires saved data view. So they need to confirm that one step further saves the current data view automatically. Currently it looks like this:

many thx!

@kertal
Copy link
Member

kertal commented Aug 11, 2022

Oh, one more thing @dimaanj if I confirm the data view to be persisted, the data view selector doesn't contain the new entry , it stays selected of course

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.

Pulled and tested locally, and overall it seems to be working well! I agree with @kertal that some functional tests for the flyout and invalid actions that trigger the modal would be ideal, and maybe Jest tests for use_persisted_data_view.tsx if possible.

I noticed a few things while poking around that we may want to fix:

  • 'Manage this data view' somewhat works with an ad hoc data view, but it seems to throw some errors in the console when I get to the page. Maybe this should be prevented?
  • 'Add a field to this data view' opens the flyout and partially works, but everything explodes when you try to save it. This might be something to prevent for ad hoc data views. This behaviour is unrelated to the work in this PR and may even be intended -- the issue stems from runtime fields on data views that match more than one index.
  • Creating an ad hoc data view shows a 'saved' toast even though we haven't saved anything yet — maybe we should change the message for ad hoc data views?
  • Refreshing the page clears the ad hoc data view and shows an error toast with "{GENERATED_ID}" is not a configured data view ID, then falls back on the default data view — I think we should either make it clear what happened here or consider persisting the ad hoc data view to a temporary state like query string or local storage.
  • Filters work but throw some PUT request errors in the console.
  • Adding fields from the sidebar also works but throws some PUT request errors in the console.

And a couple observations that aren't things to fix, but might be useful to bring up anyway:

  • Clicking 'New' keeps the ad hoc data view. I think this might actually make sense, but I'm not sure, so I figured I should bring it up.
  • It's not clear to me if there's a way to persist the ad hoc data view without attempting an invalid action to trigger the modal. I feel it would make sense to have a way to persist the current ad hoc data view without having to trigger the modal.
  • Not directly related to this PR, but an idea to help make it clear what our state is would be to show a badge similar to the one we intend to implement for 'unsaved changes' that indicates something along the lines of 'unsaved data view'.

@kertal

This comment was marked as resolved.

@dimaanj dimaanj marked this pull request as draft August 12, 2022 08:11
@dimaanj
Copy link
Contributor Author

dimaanj commented Aug 18, 2022

@elasticmachine merge upstream

@kertal
Copy link
Member

kertal commented Sep 12, 2022

@elasticmachine merge upstream

@kertal kertal self-requested a review September 13, 2022 08:13
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.

Finishing line in sight, so when giving it another testing round I've encountered that when sharing a adhoc one in a saved search, and deciding to persist to ad hoc one, the name is lost, you can see how the data view name is switched in the data view selector

Kapture.2022-09-13.at.10.11.29.mp4

Secondly, not sure if it was an issue before, but when switching to Lens with an ad hoc one, reloading the page there's an error displayed:

Bildschirmfoto 2022-09-13 um 10 20 02

When fixing this and merging main it should be good to merge. Could you add a screen showing where the "Use without saving" is displayed in the description, then it would be clear how to test, in can be easily overlooked. many thx!

…ce-hoc-data-views

# Conflicts:
#	src/plugins/discover/public/__mocks__/services.ts
#	src/plugins/discover/public/application/main/discover_main_app.test.tsx
#	src/plugins/discover/public/application/main/hooks/use_discover_state.test.ts
#	src/plugins/discover/public/application/main/hooks/use_discover_state.ts
#	src/plugins/discover/public/application/main/hooks/use_saved_search.test.ts
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.

LGTM, great work @dimaanj ! Tested again and my last issues were resolved! Huge thanks for your effort everything you've addressed! With this PR one of the first UX issues in Discover I've encountered years ago is resolve: The need to persist a thing like index pattern / data view before I can actually see my data of interest, well it's not completely resolved. Once it's doable right in the data view picker, then this is resolved. But that's a big step!

@kertal kertal dismissed stratoula’s stale review September 13, 2022 16:28

requested changes were applied

@kertal
Copy link
Member

kertal commented Sep 13, 2022

@stratoula agreed to dismiss the change request

Copy link
Member

@ppisljar ppisljar left a comment

Choose a reason for hiding this comment

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

LGTM

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
discover 529 533 +4

Async chunks

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

id before after diff
dataViewEditor 31.9KB 31.9KB +6.0B
discover 464.8KB 469.6KB +4.8KB
lens 1.2MB 1.2MB +176.0B
total +5.0KB

Page load bundle

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

id before after diff
discover 26.1KB 26.3KB +190.0B
maps 81.2KB 81.2KB +2.0B
total +192.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
discover 36 37 +1

Total ESLint disabled count

id before after diff
discover 37 38 +1

History

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

cc @dimaanj

@dimaanj dimaanj merged commit 5213166 into elastic:main Sep 14, 2022
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Sep 14, 2022
@kertal kertal changed the title [Discover] Introduce adhoc Data Views [Discover] Implement ad-hoc data views Sep 14, 2022
@kertal kertal mentioned this pull request Nov 22, 2022
2 tasks
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:Discover Discover Application release_note:enhancement Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. v8.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Discover] Integration of ad-hoc data views