-
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
[Reporting/Dashboard] Update integration to use v2 reports #108553
[Reporting/Dashboard] Update integration to use v2 reports #108553
Conversation
…ment time filters are not working correctly
@elasticmachine merge upstream |
…on react component
Pinging @elastic/kibana-presentation (Team:Presentation) |
Pinging @elastic/kibana-app-services (Team:AppServices) |
Pinging @elastic/kibana-reporting-services (Team:Reporting Services) |
values we get from it will never contain something that cannot be passed to history.push - updated types to remove some `& SerializableRecord` instances - fixed embeddable drilldown Jest tests given that we no longer expect state to be in the URL
savedDashboard.title || | ||
i18n.translate('dashboard.share.defaultDashboardTitle', { | ||
defaultMessage: 'Dashboard [{date}]', | ||
values: { date: moment().toISOString(true) }, |
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.
Does this date string need to be converted to the user's timezone and formatted per the time format in Advanced Settings?
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.
Whether we issue a request for v1 or v2 reports depends on the jobProviderOptions
that are passed in. If they contain locatorParams
then we know it's a v2 report type. To answer your question: yes v1 can be accessed from this UI and depends on the values passed in from the consumer.
I decided to keep it this way because I was not sure whether other parts of Kibana (like Canvas and visualize) still depend on v1 report types based on the params they pass in. Once they've all been updated we should remove this funcitonality - and probably send out a message that Reports now requires locators. WDYT?
savedDashboard.title || | ||
i18n.translate('dashboard.share.defaultDashboardTitle', { | ||
defaultMessage: 'Dashboard [{date}]', | ||
values: { date: moment().toISOString(true) }, |
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.
Does this date string need to be converted to the user's timezone and formatted per the time format in Advanced Settings?
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.
That's a great point @tsullivan ! Do you mind if I address this in a follow up PR as I did this same thing in discover
kibana/src/plugins/discover/public/application/apps/main/components/top_nav/get_top_nav_links.ts
Line 129 in f0bf877
values: { date: moment().toISOString(true) }, |
@elasticmachine merge upstream |
@@ -26,7 +33,8 @@ const cleanEmptyKeys = (stateObj: Record<string, unknown>) => { | |||
|
|||
export const DASHBOARD_APP_LOCATOR = 'DASHBOARD_APP_LOCATOR'; | |||
|
|||
export interface DashboardAppLocatorParams extends SerializableRecord { | |||
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions | |||
export type DashboardAppLocatorParams = { |
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.
Nit: maybe add a comment about why this is not an interface?
// TODO: Remove this code once everyone is using the new PDF format, then we can also remove the legacy | ||
// export type entirely | ||
export const isJobV2Params = ({ sharingData }: { sharingData: Record<string, unknown> }): boolean => | ||
Array.isArray(sharingData.locatorParams); | ||
Array.isArray(sharingData.locatorParams) || isObject(sharingData.locatorParams); |
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.
Would returning sharingData.locatorParams != null
work more simply?
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.
Happy to go with your suggestion, I was trying to be more strict in what values pass the test, but I don't think it adds much value in this case.
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 left a few small comments, but this LGTM!
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]Module Count
Public APIs missing comments
Async chunks
Public APIs missing exports
Page load bundle
Unknown metric groupsAPI count
References to deprecated APIs
History
To update your PR or re-run it, just comment with: |
I'm going to merge this for now so that we can get a good amount of time for this in master. I think we've addressed @ppisljar's concerns regarding types (used |
…08553) * very wip, updating dashboard integration to use v2 reports. at the moment time filters are not working correctly * added missing dependency to hook * added tests and refined ForwadedAppState interface * remove unused import * updated test because generating a report from an unsaved report is possible * migrated locator to forward state on history only, reordered methods on react component * remove unused import * update locator test and use panel index number if panelIndex does not exist * ensure locator params are serializable * - moved getSerializableRecord to locator.ts to ensure that the values we get from it will never contain something that cannot be passed to history.push - updated types to remove some `& SerializableRecord` instances - fixed embeddable drilldown Jest tests given that we no longer expect state to be in the URL * update generated api docs * remove unused variable * - removed SerializedRecord extension from dashboard locator params interface - factored out state conversion logic from the locator getLocation * updated locator jest tests and SerializableRecord types * explicitly map values to dashboardlocatorparams and export serializable params type * use serializable params type in embeddable * factored out logic for converting panels to dashboard panels map * use "type =" instead of "interface" * big update to locator params: type fixes and added options key * added comment about why we are using "type" alias instead of "interface" declaration * simplify is v2 job param check Co-authored-by: Kibana Machine <[email protected]>
…110177) * very wip, updating dashboard integration to use v2 reports. at the moment time filters are not working correctly * added missing dependency to hook * added tests and refined ForwadedAppState interface * remove unused import * updated test because generating a report from an unsaved report is possible * migrated locator to forward state on history only, reordered methods on react component * remove unused import * update locator test and use panel index number if panelIndex does not exist * ensure locator params are serializable * - moved getSerializableRecord to locator.ts to ensure that the values we get from it will never contain something that cannot be passed to history.push - updated types to remove some `& SerializableRecord` instances - fixed embeddable drilldown Jest tests given that we no longer expect state to be in the URL * update generated api docs * remove unused variable * - removed SerializedRecord extension from dashboard locator params interface - factored out state conversion logic from the locator getLocation * updated locator jest tests and SerializableRecord types * explicitly map values to dashboardlocatorparams and export serializable params type * use serializable params type in embeddable * factored out logic for converting panels to dashboard panels map * use "type =" instead of "interface" * big update to locator params: type fixes and added options key * added comment about why we are using "type" alias instead of "interface" declaration * simplify is v2 job param check Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
Summary
Closes #99890
Updates the dashboard-reporting integration so that dashboard uses v2 export types. This enables PNG/PDF reports to be generated without first needing to save as well as using locators instead of storing URLs.
How to test
To reviewers
scopedHistory.location.state
instead of the URL and created a new interface calledForwardedDashboardState
. This is the shape of the data dashboard should expect to find onscopedHistory.location.state
.Screenshots
Unsaved dashboard, with unsaved panel (on the left):
Release note
Dashboard PDF and PNG reports can now be generated without requiring users to first save.
TODO