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

[Reporting] Relax save requirement for CSV reports #99313

Merged

Conversation

jloleysens
Copy link
Contributor

@jloleysens jloleysens commented May 5, 2021

Summary

Part one of addressing this issue: #18439

Release note

We relaxed the requirement to first create a saved search when generating a CSV report via the share menu in Discover.

Checklist

Delete any items that are not applicable to this PR.

@jloleysens jloleysens requested a review from tsullivan May 5, 2021 09:46
@tsullivan
Copy link
Member

There should be a default title (with translations applied) so the when you see the report in the management app, it has some kind of title (maybe "New search"):
image

@@ -85,7 +90,7 @@ class ReportingPanelContentUi extends Component<Props, State> {
}

public render() {
if (this.isNotSaved() || this.props.isDirty || this.state.isStale) {
if (this.mustSaveReport()) {
Copy link
Member

Choose a reason for hiding this comment

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

I think we can simply add a prop to the ReportingPanelContent component called requiresSavedState or something. In x-pack/plugins/reporting/public/share_context_menu/register_csv_reporting.tsx#L109, the prop is hardcoded to false and in x-pack/plugins/reporting/public/components/screen_capture_panel_content.tsx#L45 it is hardcoded to true.

Suggested change
if (this.mustSaveReport()) {
if (this.props.requiresSavedState() && this.isNotSaved() || this.props.isDirty || this.state.isStale) {

@tsullivan
Copy link
Member

I recalled an issue that was closed as a duplicate of #18439

  1. Create a dashboard and add a saved search panel that has expanded columns
  2. Re-arrange the columns
  3. Download a CSV export

The columns in the export should match the state set by the user in the dashboard panel

Here's the original issue: #43977

@jloleysens
Copy link
Contributor Author

@elasticmachine merge upstream

@jloleysens
Copy link
Contributor Author

@tsullivan Thanks for providing context and extra things to consider!

The columns in the export should match the state set by the user in the dashboard panel

This sounds like something that we should look into addressing in another PR if there is a specific issue. I tested with discover and it looks like field order is preserved

It has some kind of title (maybe "New search")

Great point! I came up with the following

Screenshot 2021-05-06 at 12 25 01

My reasoning behind the current implementation is that reporting should not have to guess what the title should be based on object type, rather users of reporting should take the responsibility of ensuring that an appropriate title is provided. In this way titles can contain a bit more context. Let me know if you think reporting should also have a fallback for titles, though.

@jloleysens jloleysens marked this pull request as ready for review May 6, 2021 10:59
@jloleysens jloleysens requested a review from a team May 6, 2021 10:59
@jloleysens jloleysens added (Deprecated) Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead release_note:enhancement Team:AppServices v7.14.0 v8.0.0 labels May 6, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-services (Team:AppServices)

@jloleysens
Copy link
Contributor Author

@elasticmachine merge upstream

@jloleysens
Copy link
Contributor Author

@elasticmachine merge upstream

savedSearch.title ||
i18n.translate('discover.localMenu.fallbackReportTitle', {
defaultMessage: 'Discover search [{date}]',
values: { date: moment().toISOString() },
Copy link
Member

Choose a reason for hiding this comment

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

Without true it would return UTC time, but I think it would be more useful to provide an ISO string with offset to UTC

Suggested change
values: { date: moment().toISOString() },
values: { date: moment().toISOString(true) },

BTW great improvement! love it that you no longer have to save a search to export!

@jloleysens
Copy link
Contributor Author

@elasticmachine merge upstream

@tsullivan tsullivan self-requested a review May 11, 2021 16:56
Copy link
Member

@tsullivan tsullivan left a comment

Choose a reason for hiding this comment

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

LGTM

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

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

id before after diff
discover 410.4KB 410.6KB +206.0B

Page load bundle

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

id before after diff
reporting 84.3KB 84.4KB +77.0B
Unknown metric groups

References to deprecated APIs

id before after diff
crossClusterReplication 8 6 -2
fleet 4 2 -2
globalSearch 4 2 -2
licensing 18 15 -3
total -9

History

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

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.

Kibana app owned code LGTM, thx for this little big change! Tested locally, timestamp in the CSV title now is also helpful for non-UTC people 🕐

@jloleysens jloleysens merged commit c22d9fd into elastic:master May 12, 2021
@jloleysens jloleysens deleted the reporting/relax-save-requirement-for-csv branch May 12, 2021 08:32
jloleysens added a commit to jloleysens/kibana that referenced this pull request May 12, 2021
* update requirement to save csv report in ui

* update expectation that CSV reporting is disabled for new discover searches

* update test expectations (again)

* refactor to using props-driven approach

* provide a fallback title

* refine title a bit more

* added component level test

* return ISO string with offset

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
jloleysens added a commit that referenced this pull request May 12, 2021
* update requirement to save csv report in ui

* update expectation that CSV reporting is disabled for new discover searches

* update test expectations (again)

* refactor to using props-driven approach

* provide a fallback title

* refine title a bit more

* added component level test

* return ISO string with offset

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
(Deprecated) Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead release_note:enhancement v7.14.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants