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

Custom branding: PDF reports #4426

Closed
4 tasks done
Tracked by #4392
AlexRuiz7 opened this issue Aug 31, 2022 · 6 comments · Fixed by #4505, #4782 or #4783
Closed
4 tasks done
Tracked by #4392

Custom branding: PDF reports #4426

AlexRuiz7 opened this issue Aug 31, 2022 · 6 comments · Fixed by #4505, #4782 or #4783
Assignees

Comments

@AlexRuiz7
Copy link
Member

AlexRuiz7 commented Aug 31, 2022

Description

As described in #4392, we need to add the ability to white-label the reports generated by the App.

Screenshot from 2022-08-31 12-08-17

Pre-conditions

Tasks

Custom logo

Definitions

  • wazuh_logo: Wazuh's original logo, as seen in the image.
  • custom_logo: user chosen logo. By default, this logo will be a copy of wazuh_logo.

Strategy

These 2 logos will live in the app's space simultaneously (the paths are yet to be defined). The app will always use the custom_logo. The following states and mutations are allowed:

  • (S) initial: custom_logo = wazuh_logo
  • (M) update: custom_logo overwritten with uploaded logo
  • (M) delete: custom_logo overwritten with wazuh_logo

Depends on: #4443

@AlexRuiz7 AlexRuiz7 mentioned this issue Aug 31, 2022
13 tasks
@AlexRuiz7 AlexRuiz7 changed the title Custom branding-- reports' logo Custom branding-- reports Aug 31, 2022
@gdiazlo gdiazlo added this to the Release 4.4.0 milestone Aug 31, 2022
@gdiazlo gdiazlo moved this to Triage in Release 4.4.0 Aug 31, 2022
@gdiazlo gdiazlo moved this from Triage to Todo in Release 4.4.0 Aug 31, 2022
@Desvelao
Copy link
Member

Desvelao commented Sep 5, 2022

Proposal

Goal

The user should be able to customize the data displayed in the PDF reports related to:

  • the header (in the example, the company's site and email)
  • the footer (in the example, the Copyright)

Implementation

Add the new plugin's settings and use them if the custom branding is enabled.

We want to offer the users the possibility to add whatever they like in the header and the footer of the PDF reports, not only the website, the email and the copyright, as seen in the example.

New settings

Setting Description Configurable in file Configurable in UI Validation
customization.reports.header Header text for PDF reports Yes Yes Max: 3 lines. Max characters by line: 20
customization.reports.footer Footer text for PDF reports Yes Yes Max: 2 lines. Max characters by line: 30

Tasks

  • Create the new plugin's settings.
  • Adapt the PDF report generation to use these new settings.
  • Test

@Desvelao
Copy link
Member

Desvelao commented Sep 5, 2022

I added the new settings and adapted the generation of PDF reports.

I think it will be interesting to support multiple lines. This requires changing the input type (and the input form in the Settings/Configuration view) and see how the data is stored in the configuration file. I found some problems when the values contain new lines.

Tasks

  • Fix the current problems when new lines are used in the footer and header values.

@Desvelao
Copy link
Member

Desvelao commented Sep 5, 2022

Should we allow the users to use empty strings in these values?

In that case, anything will be displayed in the related sections of the PDF.

@Desvelao
Copy link
Member

Desvelao commented Sep 9, 2022

  • Fixed a problem when using multiple lines in the value of the settings cutomization.reports.footer and customization.reports.header and saving the configuration from UI.

@Desvelao
Copy link
Member

Desvelao commented Sep 9, 2022

Enhancement suggestion

I was investigating the possibility to resize the custom logo in the PDF reports.

It is possible to use the fit property to fit the image to the defined size in the property. More information in https://pdfmake.github.io/docs/0.1/document-definition-object/images.

We could use it to avoid the custom image overlay the text of the report.

@Desvelao Desvelao linked a pull request Sep 13, 2022 that will close this issue
@Desvelao Desvelao linked a pull request Sep 13, 2022 that will close this issue
@AlexRuiz7 AlexRuiz7 changed the title Custom branding-- reports Custom branding: PDF reports Sep 14, 2022
@asteriscos asteriscos self-assigned this Sep 14, 2022
@asteriscos asteriscos moved this from Todo to In Review in Release 4.4.0 Sep 14, 2022
@asteriscos asteriscos moved this from In Review to In Progress in Release 4.4.0 Sep 14, 2022
@AlexRuiz7 AlexRuiz7 moved this from In Progress to On Hold in Release 4.4.0 Sep 16, 2022
@AlexRuiz7 AlexRuiz7 moved this from On Hold to In Progress in Release 4.4.0 Oct 5, 2022
@Desvelao Desvelao moved this from In Progress to In Review in Release 4.4.0 Oct 11, 2022
@Desvelao
Copy link
Member

Update

  • Added a character count limitation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment