-
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
Use locators service for Discover shared URLs #154947
Conversation
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
src/plugins/discover/public/application/main/components/top_nav/get_top_nav_links.tsx
Outdated
Show resolved
Hide resolved
src/plugins/discover/public/application/main/hooks/use_adhoc_data_views.ts
Outdated
Show resolved
Hide resolved
I still need to update functional tests for this. I'm also running into a bug where shorten URLs aren't working initially... But this may be a bug with the short URL service directly. I'm still investigating. |
@kertal Could you see if this is working now as expected? As far as I can tell it's working properly now. |
Generally looking good 👍 The question is here, if the old behavior was right, since we communicate to the user we just share the URL to the saved version of the saved object? |
src/plugins/discover/public/application/main/components/top_nav/get_top_nav_links.tsx
Show resolved
Hide resolved
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.
SharedUX code changes LGTM.
I created the bug issue for pinned filters here: #156275 |
@elasticmachine merge upstream |
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 is great work 👍 ! Sometimes easy looking things turn into a 🐰🕳️ ! So it needs a gentle 🦊 like you to dig a bit deeper. One hopefully last thing I encountered while testing ... it seems it's not possible to create a CSV link with temporary data views, because the link gets to long? seems it contains lots of mappings?
If there's no workaround for this we might consider to not provide this button when using temporary data views
// This logic is duplicated from `relativeToAbsolute` (for bundle size reasons). Ultimately, this should be | ||
// replaced when https://github.com/elastic/kibana/issues/153323 is implemented. | ||
const link = document.createElement('a'); | ||
link.setAttribute('href', relativeUrl); | ||
const shareableUrl = link.href; |
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 think this needs to be updated, since this was merged, but doesn't seem to solve the issue
I do agree with you, it should not be necessary to use this workaround. If getUrl works it should also be possible to use getRedirectUrl
as an absolute URL .. FYI @vadimkibana
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.
Anyway thx for taking care of the bundle size @lukasolson
This should be fixed now, do you mind giving it one more look? 🙏 🙇 |
@@ -107,7 +107,7 @@ export async function getSharingData( | |||
|
|||
searchSource.setField('fields', fields); | |||
} | |||
return searchSource.getSerializedFields(true); | |||
return searchSource.getSerializedFields(true, false); |
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.
@lukasolson should this be false
only for ad-hoc data views?
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'm not sure why you'd want to send the field list/mappings in the request since they don't seem to be necessary to the POST URL. Is there something that is being accessed from this list in the CSV generation?
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.
Reporting doesn't care about the parameters, as they just get forwarded to other dependencies on the server side when the report is generating. These are all called in the kbn-generate-csv
package:
- searchSource.getSearchRequestBody()
- data.search()
- field formatters
- tabifyDocs()
If those dependencies do not need the field list or mappings, then I agree with you they don't seem to be necessary. It may have just been a carryover from an older implementation.
On a side note, I find the CSV export implementation that passes a searchsource object in the parameters to be overly complex, and since it doesn't reference a saved search it isn't user-friendly for advanced users that want to automate reports of any saved search. That's why I consider the csv_searchsource
export type to be tech debt: #151190
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Page load bundle
Unknown metric groupsAPI count
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @lukasolson |
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.
LGTM, 🕺 Thx! Tested locally and also the CSV POST thingy now works. Once @tsullivan's question is clarified, pls ship it. Great work! Really excited we now fully support temporary data views and can remove those workarounds!
Summary
Resolves #148886.
Resolves #142525.
Resolves #156275.
Resolves #142522.
Uses the URL locators service for generating the URL when clicking "Share" in Discover. This enables ad-hoc data views in shared URLs. As a result, we no longer show a prompt to save the ad-hoc data view before sharing, which means we can get rid of some no-longer used hooks.
Checklist
For maintainers
Release notes
Updates Discover sharing capabilities to enable sharing a link to Discover when using ad-hoc (temporary) data views.
Enables export to CSV when using ad-hoc data views.