Skip to content

Commit

Permalink
Fix visualizations with dark mode background in PDF report (#3315)
Browse files Browse the repository at this point in the history
  • Loading branch information
asteriscos authored Jun 1, 2021
1 parent 6e532ae commit 6323c4f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ All notable changes to the Wazuh app project will be documented in this file.
- Fix error in how the SCA check's checks are displayed [#](https://github.com/wazuh/wazuh-kibana-app/pull/3297)
- Fixed message of error when add sample data fails [#3241](https://github.com/wazuh/wazuh-kibana-app/pull/3241)
- Fixed modules are missing in the agent menu [#3244](https://github.com/wazuh/wazuh-kibana-app/pull/3244)
- Fixed dark mode visualization background in pdf reports [#3315](https://github.com/wazuh/wazuh-kibana-app/pull/3315)
- Adapt Kibana integrations to Kibana 7.11 and 7.12 [#3309](https://github.com/wazuh/wazuh-kibana-app/pull/3309)
- Fixed error agent view does not render correctly [#3306](https://github.com/wazuh/wazuh-kibana-app/pull/3306)

Expand Down
17 changes: 14 additions & 3 deletions public/components/common/modules/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,24 @@ export class MainModule extends Component {
this.setState({ loadingReport: true });
const isDarkModeTheme = getUiSettings().get('theme:darkMode');
if (isDarkModeTheme) {

//Patch to fix white text in dark-mode pdf reports
const defaultTextColor = '#DFE5EF';

//Patch to fix dark backgrounds in visualizations dark-mode pdf reports
const $labels = $('.euiButtonEmpty__text, .echLegendItem');
const $vizBackground = $('.echChartBackground');
const defaultVizBackground = $vizBackground.css('background-color');

try {
$('.euiButtonEmpty__text').css('color', 'black');
$labels.css('color', 'black');
$vizBackground.css('background-color', 'transparent');
await this.startVis2PngByAgent();
$('.euiButtonEmpty__text').css('color', defaultTextColor);
$vizBackground.css('background-color', defaultVizBackground);
$labels.css('color', defaultTextColor);
} catch (e) {
$('.euiButtonEmpty__text').css('color', defaultTextColor);
$labels.css('color', defaultTextColor);
$vizBackground.css('background-color', defaultVizBackground);
this.setState({ loadingReport: false });
}
} else {
Expand Down

0 comments on commit 6323c4f

Please sign in to comment.