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

Generate PDF report button doesn't work in Firefox #6900

Closed
asteriscos opened this issue Aug 6, 2024 · 4 comments · Fixed by #6902
Closed

Generate PDF report button doesn't work in Firefox #6900

asteriscos opened this issue Aug 6, 2024 · 4 comments · Fixed by #6902
Assignees
Labels
level/task Task issue type/bug Bug issue

Comments

@asteriscos
Copy link
Member

Wazuh Rev Browser
4.9.0 06 Firefox

Description
When using a Firefox browser the create PDF report doesn't work, and throws an error.

Preconditions

  1. Use Firefox

Steps to reproduce

  1. Navigate to any dashboard
  2. Click on Generate report
  3. See the error

Screenshots

Peek 2024-08-06 21-21

image

@asteriscos asteriscos added type/bug Bug issue level/task Task issue labels Aug 6, 2024
@wazuhci wazuhci moved this to Backlog in Release 4.9.0 Aug 6, 2024
@Desvelao Desvelao self-assigned this Aug 7, 2024
@wazuhci wazuhci moved this from Backlog to In progress in Release 4.9.0 Aug 7, 2024
@Desvelao
Copy link
Member

Desvelao commented Aug 8, 2024

Research

The error is caused by a problem getting the screenshots of the visualizations. Editing the source code to display the error on console:

Image

A recent pull request https://github.com/wazuh/wazuh-dashboard-plugins/pull/6558/files#diff-09c83b245d7d7757479c6f6bce9a14e1e15823a12d4e827885ed2b584d69f06dR480-R482 for 4.9.0 added a fix for the dom-to-image dependency library.

I tried to remove the fix, and this avoids the error reported on the issue, but the logic to get the visualization screenshots seems to enter into a loop and the report can not be generated. This behavior happens on Firefox and Google Chrome.

@Desvelao
Copy link
Member

Desvelao commented Aug 8, 2024

I tried to replace the embedded dom-to-image dependency by https://www.npmjs.com/package/dom-to-image-more and this seems to fix the problem related to the loop.

yarn add dom-to-image-more

It installed the v3.3.1.

But it seems on Firefox, some images are cropped. Related issue: 1904labs/dom-to-image-more#160

@Desvelao
Copy link
Member

Desvelao commented Aug 8, 2024

Solution

I added a embedded dom-to-image-more dependency because I wanted to remove the font fetching logic that was customized on the dom-to-image library.

I applied a fix to solve the problem related to cropped images on Firefox.

@yenienserrano and me were reviewing the generation of reports on Safari and Firefox too.

I created the following pull request with the proposed solution: #6902

@wazuhci wazuhci moved this from In progress to In review in Release 4.9.0 Aug 9, 2024
@Desvelao
Copy link
Member

Changes

  • Fixed some problems with texts of metrics that caused poorly render on the PDF reports

@wazuhci wazuhci moved this from In review to In final review in Release 4.9.0 Aug 13, 2024
@wazuhci wazuhci moved this from In final review to Done in Release 4.9.0 Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
level/task Task issue type/bug Bug issue
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants