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

[Lens] Enable report sharing #153429

Merged
merged 35 commits into from
Apr 12, 2023
Merged

[Lens] Enable report sharing #153429

merged 35 commits into from
Apr 12, 2023

Conversation

dej611
Copy link
Contributor

@dej611 dej611 commented Mar 22, 2023

Summary

Fixes #130438

This PR introduces the PNG/PDF reporting feature within Lens editor.
Note each reporting tasks is generating a shortURL SO in addition of the reporting job SO. There's a reusing mechanism but it applies only to the same config within the same session.

  • Enable reporting for lens_visualization type lens type
    • Introduce disabled state within the reporter logic
    • Extends the logic to support the custom URL types in Lens
    • Make reporting list page to support lens_visualization object type
      • migrated lens_visualization to lens and used the app icon
    • Extends the custom CSS styling to handle specific Lens editor layout
  • Introduce logic for renderComplete within the Lens editor
    • Loading logic
    • Trigger renderComplete event for the right node
  • Add .hide-for-sharing class where needed
    • Add the .stretch-for-sharing where needed
  • Improve layout settings to have a better fit of some charts
    • Maybe this can be addressed as separate issue?
  • Check the renderComplete for the RegionMap external plugin => separate issue
  • Write tests
    • Functional tests

Reporting page:
Screenshot 2023-03-24 at 15 25 12

Note: at the moment the reporting name follows the CSV naming convention of unsaved for unsaved Lens visualizations. The legacy Agg-based editor uses instead a namming pattern as follow: Visualization <timestamp>.png.

Final results:

Chart type PNG result
Stacked bar chart unsaved
Vertical bar chart unsaved (1)
Horizontal stacked bar chart unsaved (2)
Horizontal bar chart unsaved (3)
Datatable unsaved (4)
Horizontal gauge unsaved (5)
Vertical gauge unsaved (6)
Legacy metric unsaved (7)
Metric unsaved (8)
Metric with breakdown unsaved (9)
Area chart unsaved (10)
Line chart unsaved (11)
Bar chart with annotation + reference lines unsaved (13)
Heatmap unsaved (14)
Donut chart unsaved (15)
Pie chart unsaved (17)
Treemap unsaved (18)
Mosaic unsaved (16)
Waffle unsaved (19)
Region Map Lens Visualization  2023-03-31T12_47_48 392+02_00

Checklist

Delete any items that are not applicable to this PR.

Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

Risk Probability Severity Mitigation/Notes
Multiple Spaces—unexpected behavior in non-default Kibana Space. Low High Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces.
Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. High Low Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure.
Code should gracefully handle cases when feature X or plugin Y are disabled. Medium High Unit tests will verify that any feature flag or plugin combination still results in our service operational.
See more potential risk examples

For maintainers

@dej611 dej611 added release_note:enhancement Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Lens v8.8.0 labels Mar 22, 2023
@@ -624,6 +624,12 @@ export const InnerWorkspacePanel = React.memo(function InnerWorkspacePanel({
);
});

function dispatchRenderComplete(node: HTMLDivElement | null) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's also a RenderCompleteDispatcher class, but for just few lines I thought to inline it here

Copy link
Member

Choose a reason for hiding this comment

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

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 it's good to use your inline dispatcher.

@@ -7,6 +7,11 @@
display: none !important;
}

/* some elements needs to be stretched to be shared */
.stretch-for-sharing {
margin: 0px;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have not found any other solution here to remove the bottom margin in Lens' workspace, used to space the suggestion panel from the chart one.

@dej611 dej611 marked this pull request as ready for review March 23, 2023 16:31
@dej611 dej611 requested review from a team as code owners March 23, 2023 16:32
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-visualizations @elastic/kibana-visualizations-external (Team:Visualizations)

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.

This looks awesome Marco, def one of my favorite enhancements for 8.8. PNGs are created without stretching but I see some stretching on pdfs
image

I tested the agg based and they also have the same problem so I think it is fine for now.

Question: When I share an unsaved agg based visualization the report has the title Visualization[DATE]. Can we do the same for Lens? Because now all of them have the unsaved title and can be difficult for someone to identify them (the date can always help)

image

  • Exporting a metric with a scrollbar is generating a png that misses the last row. Can we fix it? (same happens with a bar with a very long legend)

image

Copy link
Contributor

Choose a reason for hiding this comment

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

@dej611 can we run a test runner 50 times to ensure that the tests added are not flaky?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@stratoula
Copy link
Contributor

I also see this error on the kibana server every time I export a lens viz
image

@dej611
Copy link
Contributor Author

dej611 commented Mar 24, 2023

I also see this error on the kibana server every time I export a lens viz image

That is not dependent on this reporting PR but it happens also in main.
To reproduce:

  • get a snapshot URL from the share action
  • paste the URL in a browser and open the devtools console

I think it can be addressed as separate issue.

  • Exporting a metric with a scrollbar is generating a png that misses the last row. Can we fix it? (same happens with a bar with a very long legend)

I will look into this but that is happening also to datatable and with the legacy agg-based datatables as well: for scrollable visualizations it seems the reporting task is not taking the full height in consideration.

Question: When I share an unsaved agg based visualization the report has the title Visualization[DATE]. Can we do the same for Lens? Because now all of them have the unsaved title and can be difficult for someone to identify them (the date can always help)

Sure, it is possible. Right now it matches the CSV naming behaviour but will look into it 👍

@stratoula
Copy link
Contributor

got it Marco thanx, I am fine with the first 1. About the second I am also fine if it is something that needs an investigation and is not an easy fix. Thanx for looking into the 3rd one!

@dej611
Copy link
Contributor Author

dej611 commented Mar 24, 2023

Updated the naming convention. Note that unfortunately this applies also to the CSV exporting.

@dej611
Copy link
Contributor Author

dej611 commented Mar 31, 2023

After #153492 the reporting feature worked also for RegionMap when embedded in dashboard, but not when in Lens Editor.
e8c4e5f fixed this issue, which was due to an initial error on bootstrap, now prevented with the correct check.

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.

This is looking great, and it's so close! I still see one issue where the report doesn't contain the latest state of the work in the browser.

Steps to reproduce:

  1. Install eCommerce Sample Data
  2. Open the Dashboard, click Edit
  3. Edit the "Breakdown by Category" visualization
  4. Save the visualization to the library (uncheck Update panel on Dashboard)
  5. Now make a change to the visualization. Example: change the breakdown field to customer first name.
  6. Without saving the visualization, make a PNG report
  7. The report shows the breakdown by category still - not the unsaved changes.

Users should be able to make a report that includes some ad-hoc (unsaved) changes. It's not uncommon to see users with reporting privileges and read-only privileges to visualizations. Therefore, when a report is made based on a saved object with some unsaved changes, the report should show what the browser shows: a merge of the saved state and the ad-hoc changes.

@dej611
Copy link
Contributor Author

dej611 commented Apr 4, 2023

This is looking great, and it's so close! I still see one issue where the report doesn't contain the latest state of the work in the browser.

Steps to reproduce:

  1. Install eCommerce Sample Data
  2. Open the Dashboard, click Edit
  3. Edit the "Breakdown by Category" visualization
  4. Save the visualization to the library (uncheck Update panel on Dashboard)
  5. Now make a change to the visualization. Example: change the breakdown field to customer first name.
  6. Without saving the visualization, make a PNG report
  7. The report shows the breakdown by category still - not the unsaved changes.

Users should be able to make a report that includes some ad-hoc (unsaved) changes. It's not uncommon to see users with reporting privileges and read-only privileges to visualizations. Therefore, when a report is made based on a saved object with some unsaved changes, the report should show what the browser shows: a merge of the saved state and the ad-hoc changes.

Fixed in fe0d606 for both v1 and v2.
The only problem now is that in a dirty state the URL is too long and cannot be exported via CURL: Lens uses the shortURL service because its locator URL is too long, but reporting v2 is ignoring such parameter. Maybe it is possible to enhance it to support the given URL like v1 or use the shortURL service (if available) for such case?

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

Great work! Thanks for bearing with me through the requirements about optimizing the locator params.

@tsullivan
Copy link
Member

tsullivan commented Apr 6, 2023

The only problem now is that in a dirty state the URL is too long and cannot be exported via CURL: Lens uses the shortURL service because its locator URL is too long, but reporting v2 is ignoring such parameter. Maybe it is possible to enhance it to support the given URL like v1 or use the shortURL service (if available) for such case?

Let's not worry greatly that a POST URL can't be copied from Lens when the visualization is in a dirty state. Advanced users will be able to modify the POST URL to add filters if needed.

Sorry that the integration is in a confusing state, since the share panel options accept a URL but that URL is not used for Reporting. The V1 interface only exists from tech debt, since putting a URL in the job parameters doesn't serve a great purpose for the future plans of reporting.

@@ -116,7 +118,7 @@ export const reportingScreenshotShareProvider = ({
});

const jobProviderOptions: JobParamsProviderOptions = {
shareableUrl,
shareableUrl: isDirty ? shareableUrl : shareableUrlForSavedObject ?? shareableUrl,
Copy link
Member

Choose a reason for hiding this comment

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

I've filed this issue to remove V1 code from reporting, which will make the shareableUrl field not part of JobParamsProviderOptions in the future: #154601

@kibana-ci
Copy link
Collaborator

💚 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
lens 1.3MB 1.3MB +1.5KB
reporting 58.8KB 58.9KB +169.0B
total +1.6KB

Page load bundle

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

id before after diff
lens 34.3KB 34.3KB +24.0B
reporting 42.5KB 42.6KB +88.0B
total +112.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
securitySolution 433 436 +3

Total ESLint disabled count

id before after diff
securitySolution 513 516 +3

History

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

@dej611 dej611 merged commit 41170fe into elastic:main Apr 12, 2023
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Apr 12, 2023
@KOTungseth KOTungseth mentioned this pull request Apr 25, 2023
19 tasks
KOTungseth added a commit that referenced this pull request May 23, 2023
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request May 23, 2023
kibanamachine referenced this pull request May 23, 2023
# Backport

This will backport the following commits from `main` to `8.8`:
- [[DOCS] Adds 8.8 Viz docs
(#157215)](#157215)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Kaarina
Tungseth","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-05-23T15:41:42Z","message":"[DOCS]
Adds 8.8 Viz docs (#157215)\n\n## Summary\r\n\r\nAdds the 8.8
documentation for the following:\r\n\r\n- Enable report sharing:
https://github.com/elastic/kibana/pull/153429\r\nDocs
preview:\r\nhttps://kibana_157215.docs-preview.app.elstc.co/guide/en/kibana/master/reporting-getting-started.html\r\n\r\n-
Random sampling feature:
https://github.com/elastic/kibana/pull/143221\r\nDocs
preview:\r\nhttps://kibana_157215.docs-preview.app.elstc.co/guide/en/kibana/master/lens.html#improve-visualization-loading-time\r\n\r\n-
Improve Ignore global filters
UI:\r\nhttps://github.com//pull/154441
and\r\nhttps://github.com//pull/155280\r\nDocs
preview:\r\nhttps://kibana_157215.docs-preview.app.elstc.co/guide/en/kibana/master/lens.html#add-annotations\r\n\r\n---------\r\n\r\nCo-authored-by:
Tim Sullivan
<[email protected]>","sha":"06a800fbad1f2a8fd9146bfe0c439e2107f771fc","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Docs","release_note:skip","Team:SharedUX","v8.8.0","v8.9.0"],"number":157215,"url":"https://github.com/elastic/kibana/pull/157215","mergeCommit":{"message":"[DOCS]
Adds 8.8 Viz docs (#157215)\n\n## Summary\r\n\r\nAdds the 8.8
documentation for the following:\r\n\r\n- Enable report sharing:
https://github.com/elastic/kibana/pull/153429\r\nDocs
preview:\r\nhttps://kibana_157215.docs-preview.app.elstc.co/guide/en/kibana/master/reporting-getting-started.html\r\n\r\n-
Random sampling feature:
https://github.com/elastic/kibana/pull/143221\r\nDocs
preview:\r\nhttps://kibana_157215.docs-preview.app.elstc.co/guide/en/kibana/master/lens.html#improve-visualization-loading-time\r\n\r\n-
Improve Ignore global filters
UI:\r\nhttps://github.com//pull/154441
and\r\nhttps://github.com//pull/155280\r\nDocs
preview:\r\nhttps://kibana_157215.docs-preview.app.elstc.co/guide/en/kibana/master/lens.html#add-annotations\r\n\r\n---------\r\n\r\nCo-authored-by:
Tim Sullivan
<[email protected]>","sha":"06a800fbad1f2a8fd9146bfe0c439e2107f771fc"}},"sourceBranch":"main","suggestedTargetBranches":["8.8"],"targetPullRequestStates":[{"branch":"8.8","label":"v8.8.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/157215","number":157215,"mergeCommit":{"message":"[DOCS]
Adds 8.8 Viz docs (#157215)\n\n## Summary\r\n\r\nAdds the 8.8
documentation for the following:\r\n\r\n- Enable report sharing:
https://github.com/elastic/kibana/pull/153429\r\nDocs
preview:\r\nhttps://kibana_157215.docs-preview.app.elstc.co/guide/en/kibana/master/reporting-getting-started.html\r\n\r\n-
Random sampling feature:
https://github.com/elastic/kibana/pull/143221\r\nDocs
preview:\r\nhttps://kibana_157215.docs-preview.app.elstc.co/guide/en/kibana/master/lens.html#improve-visualization-loading-time\r\n\r\n-
Improve Ignore global filters
UI:\r\nhttps://github.com//pull/154441
and\r\nhttps://github.com//pull/155280\r\nDocs
preview:\r\nhttps://kibana_157215.docs-preview.app.elstc.co/guide/en/kibana/master/lens.html#add-annotations\r\n\r\n---------\r\n\r\nCo-authored-by:
Tim Sullivan
<[email protected]>","sha":"06a800fbad1f2a8fd9146bfe0c439e2107f771fc"}}]}]
BACKPORT-->

Co-authored-by: Kaarina Tungseth <[email protected]>
delanni pushed a commit to delanni/kibana that referenced this pull request May 25, 2023
rshen91 added a commit that referenced this pull request Aug 15, 2023
…163873)

## Summary

This PR fixes a bug mentioned in
https://github.com/elastic/sdh-kibana/issues/4016 from
#153429 where users with custom
roles should allow them the ability to generate reports (with
`xpack.reporting.roles.enabled: false`) in Dashboard. This bug doesn't
arise for users with all privileges.

- set xpack.reporting.roles.enabled false in the kibana.yml 
- load sample data 
- create a custom role where the index (whatever sample data index you
want) has the read and view_index_metadata privilege.
- Add the Kibana privilege for all spaces Analytics > Dashboard >
Generate PDF or PNG Reports and Download Csv reports from Saved Search
panels. Create the global privilege and then the role.
- Apply that role to a new user and log in using that user. 


## Before 

You can see in the console that usesUiCapabilitie in
register_pdf_png_reporting.tsx is true

<img width="1458" alt="Screenshot 2023-08-14 at 12 34 38 PM"
src="https://github.com/elastic/kibana/assets/20343860/f6b567fa-3fbd-4039-aa64-fd28bb4534fb">


## After
<img width="1343" alt="Screenshot 2023-08-14 at 2 18 30 PM"
src="https://github.com/elastic/kibana/assets/20343860/1e4ade9e-332c-4431-954a-38e8a16d4131">


### Checklist

Delete any items that are not applicable to this PR.

- [ ] 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)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [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
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] 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))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

---------

Co-authored-by: kibanamachine <[email protected]>
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Aug 15, 2023
…lastic#163873)

## Summary

This PR fixes a bug mentioned in
https://github.com/elastic/sdh-kibana/issues/4016 from
elastic#153429 where users with custom
roles should allow them the ability to generate reports (with
`xpack.reporting.roles.enabled: false`) in Dashboard. This bug doesn't
arise for users with all privileges.

- set xpack.reporting.roles.enabled false in the kibana.yml
- load sample data
- create a custom role where the index (whatever sample data index you
want) has the read and view_index_metadata privilege.
- Add the Kibana privilege for all spaces Analytics > Dashboard >
Generate PDF or PNG Reports and Download Csv reports from Saved Search
panels. Create the global privilege and then the role.
- Apply that role to a new user and log in using that user.

## Before

You can see in the console that usesUiCapabilitie in
register_pdf_png_reporting.tsx is true

<img width="1458" alt="Screenshot 2023-08-14 at 12 34 38 PM"
src="https://github.com/elastic/kibana/assets/20343860/f6b567fa-3fbd-4039-aa64-fd28bb4534fb">

## After
<img width="1343" alt="Screenshot 2023-08-14 at 2 18 30 PM"
src="https://github.com/elastic/kibana/assets/20343860/1e4ade9e-332c-4431-954a-38e8a16d4131">

### Checklist

Delete any items that are not applicable to this PR.

- [ ] 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)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [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
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] 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))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

---------

Co-authored-by: kibanamachine <[email protected]>
(cherry picked from commit 54d11a9)
kibanamachine added a commit that referenced this pull request Aug 15, 2023
…ard (#163873) (#163972)

# Backport

This will backport the following commits from `main` to `8.9`:
- [[Reporting] Allow custom roles to use image reporting in dashboard
(#163873)](#163873)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Rachel
Shen","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-08-15T19:42:06Z","message":"[Reporting]
Allow custom roles to use image reporting in dashboard (#163873)\n\n##
Summary\r\n\r\nThis PR fixes a bug mentioned
in\r\nhttps://github.com/elastic/sdh-kibana/issues/4016
from\r\nhttps://github.com//pull/153429 where users with
custom\r\nroles should allow them the ability to generate reports
(with\r\n`xpack.reporting.roles.enabled: false`) in Dashboard. This bug
doesn't\r\narise for users with all privileges.\r\n\r\n- set
xpack.reporting.roles.enabled false in the kibana.yml \r\n- load sample
data \r\n- create a custom role where the index (whatever sample data
index you\r\nwant) has the read and view_index_metadata privilege.\r\n-
Add the Kibana privilege for all spaces Analytics > Dashboard
>\r\nGenerate PDF or PNG Reports and Download Csv reports from Saved
Search\r\npanels. Create the global privilege and then the role.\r\n-
Apply that role to a new user and log in using that user. \r\n\r\n\r\n##
Before \r\n\r\nYou can see in the console that usesUiCapabilitie
in\r\nregister_pdf_png_reporting.tsx is true\r\n\r\n<img width=\"1458\"
alt=\"Screenshot 2023-08-14 at 12 34 38
PM\"\r\nsrc=\"https://github.com/elastic/kibana/assets/20343860/f6b567fa-3fbd-4039-aa64-fd28bb4534fb\">\r\n\r\n\r\n##
After\r\n<img width=\"1343\" alt=\"Screenshot 2023-08-14 at 2 18 30
PM\"\r\nsrc=\"https://github.com/elastic/kibana/assets/20343860/1e4ade9e-332c-4431-954a-38e8a16d4131\">\r\n\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] Any UI
touched in this PR is usable by keyboard only (learn more\r\nabout
[keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n-
[ ] Any UI touched in this PR does not create any new axe
failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"54d11a964c1ed86268cb1a5aca24674895ffdf13","branchLabelMapping":{"^v8.10.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Feature:Reporting","Team:SharedUX","backport:all-open","v8.10.0"],"number":163873,"url":"https://github.com/elastic/kibana/pull/163873","mergeCommit":{"message":"[Reporting]
Allow custom roles to use image reporting in dashboard (#163873)\n\n##
Summary\r\n\r\nThis PR fixes a bug mentioned
in\r\nhttps://github.com/elastic/sdh-kibana/issues/4016
from\r\nhttps://github.com//pull/153429 where users with
custom\r\nroles should allow them the ability to generate reports
(with\r\n`xpack.reporting.roles.enabled: false`) in Dashboard. This bug
doesn't\r\narise for users with all privileges.\r\n\r\n- set
xpack.reporting.roles.enabled false in the kibana.yml \r\n- load sample
data \r\n- create a custom role where the index (whatever sample data
index you\r\nwant) has the read and view_index_metadata privilege.\r\n-
Add the Kibana privilege for all spaces Analytics > Dashboard
>\r\nGenerate PDF or PNG Reports and Download Csv reports from Saved
Search\r\npanels. Create the global privilege and then the role.\r\n-
Apply that role to a new user and log in using that user. \r\n\r\n\r\n##
Before \r\n\r\nYou can see in the console that usesUiCapabilitie
in\r\nregister_pdf_png_reporting.tsx is true\r\n\r\n<img width=\"1458\"
alt=\"Screenshot 2023-08-14 at 12 34 38
PM\"\r\nsrc=\"https://github.com/elastic/kibana/assets/20343860/f6b567fa-3fbd-4039-aa64-fd28bb4534fb\">\r\n\r\n\r\n##
After\r\n<img width=\"1343\" alt=\"Screenshot 2023-08-14 at 2 18 30
PM\"\r\nsrc=\"https://github.com/elastic/kibana/assets/20343860/1e4ade9e-332c-4431-954a-38e8a16d4131\">\r\n\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] Any UI
touched in this PR is usable by keyboard only (learn more\r\nabout
[keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n-
[ ] Any UI touched in this PR does not create any new axe
failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"54d11a964c1ed86268cb1a5aca24674895ffdf13"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.10.0","labelRegex":"^v8.10.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/163873","number":163873,"mergeCommit":{"message":"[Reporting]
Allow custom roles to use image reporting in dashboard (#163873)\n\n##
Summary\r\n\r\nThis PR fixes a bug mentioned
in\r\nhttps://github.com/elastic/sdh-kibana/issues/4016
from\r\nhttps://github.com//pull/153429 where users with
custom\r\nroles should allow them the ability to generate reports
(with\r\n`xpack.reporting.roles.enabled: false`) in Dashboard. This bug
doesn't\r\narise for users with all privileges.\r\n\r\n- set
xpack.reporting.roles.enabled false in the kibana.yml \r\n- load sample
data \r\n- create a custom role where the index (whatever sample data
index you\r\nwant) has the read and view_index_metadata privilege.\r\n-
Add the Kibana privilege for all spaces Analytics > Dashboard
>\r\nGenerate PDF or PNG Reports and Download Csv reports from Saved
Search\r\npanels. Create the global privilege and then the role.\r\n-
Apply that role to a new user and log in using that user. \r\n\r\n\r\n##
Before \r\n\r\nYou can see in the console that usesUiCapabilitie
in\r\nregister_pdf_png_reporting.tsx is true\r\n\r\n<img width=\"1458\"
alt=\"Screenshot 2023-08-14 at 12 34 38
PM\"\r\nsrc=\"https://github.com/elastic/kibana/assets/20343860/f6b567fa-3fbd-4039-aa64-fd28bb4534fb\">\r\n\r\n\r\n##
After\r\n<img width=\"1343\" alt=\"Screenshot 2023-08-14 at 2 18 30
PM\"\r\nsrc=\"https://github.com/elastic/kibana/assets/20343860/1e4ade9e-332c-4431-954a-38e8a16d4131\">\r\n\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] Any UI
touched in this PR is usable by keyboard only (learn more\r\nabout
[keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n-
[ ] Any UI touched in this PR does not create any new axe
failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"54d11a964c1ed86268cb1a5aca24674895ffdf13"}}]}]
BACKPORT-->

Co-authored-by: Rachel Shen <[email protected]>
rshen91 added a commit to rshen91/kibana that referenced this pull request Aug 16, 2023
…lastic#163873)

## Summary

This PR fixes a bug mentioned in
https://github.com/elastic/sdh-kibana/issues/4016 from
elastic#153429 where users with custom
roles should allow them the ability to generate reports (with
`xpack.reporting.roles.enabled: false`) in Dashboard. This bug doesn't
arise for users with all privileges.

- set xpack.reporting.roles.enabled false in the kibana.yml
- load sample data
- create a custom role where the index (whatever sample data index you
want) has the read and view_index_metadata privilege.
- Add the Kibana privilege for all spaces Analytics > Dashboard >
Generate PDF or PNG Reports and Download Csv reports from Saved Search
panels. Create the global privilege and then the role.
- Apply that role to a new user and log in using that user.

## Before

You can see in the console that usesUiCapabilitie in
register_pdf_png_reporting.tsx is true

<img width="1458" alt="Screenshot 2023-08-14 at 12 34 38 PM"
src="https://github.com/elastic/kibana/assets/20343860/f6b567fa-3fbd-4039-aa64-fd28bb4534fb">

## After
<img width="1343" alt="Screenshot 2023-08-14 at 2 18 30 PM"
src="https://github.com/elastic/kibana/assets/20343860/1e4ade9e-332c-4431-954a-38e8a16d4131">

### Checklist

Delete any items that are not applicable to this PR.

- [ ] 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)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [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
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] 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))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

---------

Co-authored-by: kibanamachine <[email protected]>
(cherry picked from commit 54d11a9)
hop-dev pushed a commit to hop-dev/kibana that referenced this pull request Aug 16, 2023
…lastic#163873)

## Summary

This PR fixes a bug mentioned in
elastic/sdh-kibana#4016 from
elastic#153429 where users with custom
roles should allow them the ability to generate reports (with
`xpack.reporting.roles.enabled: false`) in Dashboard. This bug doesn't
arise for users with all privileges.

- set xpack.reporting.roles.enabled false in the kibana.yml 
- load sample data 
- create a custom role where the index (whatever sample data index you
want) has the read and view_index_metadata privilege.
- Add the Kibana privilege for all spaces Analytics > Dashboard >
Generate PDF or PNG Reports and Download Csv reports from Saved Search
panels. Create the global privilege and then the role.
- Apply that role to a new user and log in using that user. 


## Before 

You can see in the console that usesUiCapabilitie in
register_pdf_png_reporting.tsx is true

<img width="1458" alt="Screenshot 2023-08-14 at 12 34 38 PM"
src="https://github.com/elastic/kibana/assets/20343860/f6b567fa-3fbd-4039-aa64-fd28bb4534fb">


## After
<img width="1343" alt="Screenshot 2023-08-14 at 2 18 30 PM"
src="https://github.com/elastic/kibana/assets/20343860/1e4ade9e-332c-4431-954a-38e8a16d4131">


### Checklist

Delete any items that are not applicable to this PR.

- [ ] 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)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [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
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] 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))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

---------

Co-authored-by: kibanamachine <[email protected]>
bryce-b pushed a commit that referenced this pull request Aug 22, 2023
…163873)

## Summary

This PR fixes a bug mentioned in
elastic/sdh-kibana#4016 from
#153429 where users with custom
roles should allow them the ability to generate reports (with
`xpack.reporting.roles.enabled: false`) in Dashboard. This bug doesn't
arise for users with all privileges.

- set xpack.reporting.roles.enabled false in the kibana.yml 
- load sample data 
- create a custom role where the index (whatever sample data index you
want) has the read and view_index_metadata privilege.
- Add the Kibana privilege for all spaces Analytics > Dashboard >
Generate PDF or PNG Reports and Download Csv reports from Saved Search
panels. Create the global privilege and then the role.
- Apply that role to a new user and log in using that user. 


## Before 

You can see in the console that usesUiCapabilitie in
register_pdf_png_reporting.tsx is true

<img width="1458" alt="Screenshot 2023-08-14 at 12 34 38 PM"
src="https://github.com/elastic/kibana/assets/20343860/f6b567fa-3fbd-4039-aa64-fd28bb4534fb">


## After
<img width="1343" alt="Screenshot 2023-08-14 at 2 18 30 PM"
src="https://github.com/elastic/kibana/assets/20343860/1e4ade9e-332c-4431-954a-38e8a16d4131">


### Checklist

Delete any items that are not applicable to this PR.

- [ ] 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)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [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
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] 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))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

---------

Co-authored-by: kibanamachine <[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:Lens release_note:enhancement Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.8.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Lens] Generating PDF and PNG exports directly from Lens
6 participants