-
Notifications
You must be signed in to change notification settings - Fork 186
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
Fix when generating a PDF report, the open report button in safari does not work #7019
Fix when generating a PDF report, the open report button in safari does not work #7019
Conversation
onClick={() => { | ||
// Open the new tab immediately | ||
const windowReference = window.open('', '_blank'); | ||
|
||
// Verify if the new tab was locked | ||
if (windowReference) { | ||
// Get the URL (in this case, it is obtained directly, but it can be asynchronous) | ||
const url = getHttp().basePath.prepend( | ||
`/reports/${filename}`, | ||
); | ||
|
||
// Then assign the URL to the new tab | ||
windowReference.location = url; | ||
} else { | ||
// If the tab is locked, it displays an alert to the user. | ||
alert('The tab was blocked. Please enable pop-up windows.'); | ||
} | ||
}} |
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.
thought: I see you changed to window.open
. For this case, we could try a cleaner solution using a link instead of manage the access to the report with a onClick
. Could you try it?
In the case we implement the proposed solution in the onClick
, there are more usages of window.open
that could be failing in Safari too. We should review them.
CHANGELOG.md
Outdated
@@ -21,6 +21,7 @@ All notable changes to the Wazuh app project will be documented in this file. | |||
- Fixed missing options depending on agent operating system in the agent configuration report [#6983](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6983) | |||
- Fixed an style that affected the Discover plugin [#6989](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6989) | |||
- Fixed a problem updating the API host registry in the GET /api/check-stored-api [#6995](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6995) | |||
- Fixed, when generating a PDF report, the open report button in safari does not work [#7019](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7019) |
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.
- Fixed, when generating a PDF report, the open report button in safari does not work [#7019](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7019) | |
- Fixed the `Open report` button does not work on Safari [#7019](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7019) |
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.
…pen-report-button-in-safari-does-not-work
|
|
|
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.
Screen.Recording.2024-09-26.at.2.45.50.PM.mov
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.
CR: 🟢
Test: 🟢
Description
Fix when generating a PDF report, the open report button in safari does not work
Issues Resolved
#7018
Evidence
Grabacion.de.pantalla.2024-09-25.a.la.s.4.16.02.p.m.mov
Test
[Provide instructions to test this PR
Go to some module
Click on generate pdf report
Click on open report button
Check List
yarn test:jest