Skip to content

Commit de58f90

Browse files
[Backport 4.4-7.16] Fix PDF header and footer input max row length (#4806)
Fix PDF header and footer input max row length (#4805) * Increase PDF header footer textarea max row length * Added changelog (cherry picked from commit 70ac3c9) Co-authored-by: Federico Rodriguez <federico.rodriguez@wazuh.com>
1 parent 2bc25dc commit de58f90

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ All notable changes to the Wazuh app project will be documented in this file.
1212
- Redesign the SCA table from agent's dashboard [#4512](https://github.com/wazuh/wazuh-kibana-app/pull/4512)
1313
- Enhanced the plugin setting description displayed in the UI and the configuration file. [#4501](https://github.com/wazuh/wazuh-kibana-app/pull/4501)
1414
- Added validation to the plugin settings in the form of `Settings/Configuration` and the endpoint to update the plugin configuration [#4503](https://github.com/wazuh/wazuh-kibana-app/pull/4503)[#4785](https://github.com/wazuh/wazuh-kibana-app/pull/4785)
15-
- Added new plugin settings to customize the header and footer on the PDF reports [#4505](https://github.com/wazuh/wazuh-kibana-app/pull/4505)
15+
- Added new plugin settings to customize the header and footer on the PDF reports [#4505](https://github.com/wazuh/wazuh-kibana-app/pull/4505)[#4798](https://github.com/wazuh/wazuh-kibana-app/pull/4798)[#4805](https://github.com/wazuh/wazuh-kibana-app/pull/4805)
1616
- Add a new plugin setting to enable or disable the customization [#4507](https://github.com/wazuh/wazuh-kibana-app/pull/4507)
1717

1818
### Changed

common/constants.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,7 @@ export const PLUGIN_SETTINGS: { [key: string]: TPluginSetting } = {
11171117
defaultValueIfNotSet: REPORTS_PAGE_FOOTER_TEXT,
11181118
isConfigurableFromFile: true,
11191119
isConfigurableFromUI: true,
1120-
options: { maxRows: 2, maxLength: 30 },
1120+
options: { maxRows: 2, maxLength: 50 },
11211121
validate: function (value) {
11221122
return SettingsValidator.multipleLinesString({
11231123
maxRows: this.options?.maxRows,
@@ -1137,7 +1137,7 @@ export const PLUGIN_SETTINGS: { [key: string]: TPluginSetting } = {
11371137
defaultValueIfNotSet: REPORTS_PAGE_HEADER_TEXT,
11381138
isConfigurableFromFile: true,
11391139
isConfigurableFromUI: true,
1140-
options: { maxRows: 3, maxLength: 20 },
1140+
options: { maxRows: 3, maxLength: 40 },
11411141
validate: function (value) {
11421142
return SettingsValidator.multipleLinesString({
11431143
maxRows: this.options?.maxRows,

common/plugin-settings.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,12 @@ describe('[settings] Input validation', () => {
122122
${'customization.reports.footer'} | ${'Test\nTest'} | ${undefined}
123123
${'customization.reports.footer'} | ${'Test\nTest\nTest\nTest\nTest'} | ${'The string should have less or equal to 2 line/s.'}
124124
${'customization.reports.footer'} | ${'Line with 30 characters \nTest'} | ${undefined}
125-
${'customization.reports.footer'} | ${'Line with 31 characters \nTest'} | ${"The maximum length of a line is 30 characters."}
125+
${'customization.reports.footer'} | ${'Testing maximum length of a line of more than 50 characters\nTest'} | ${"The maximum length of a line is 50 characters."}
126126
${'customization.reports.header'} | ${'Test'} | ${undefined}
127127
${'customization.reports.header'} | ${'Test\nTest'} | ${undefined}
128128
${'customization.reports.header'} | ${'Test\nTest\nTest\nTest\nTest'} | ${'The string should have less or equal to 3 line/s.'}
129129
${'customization.reports.header'} | ${'Line with 20 charact\nTest'} | ${undefined}
130-
${'customization.reports.header'} | ${'Line with 23 characters\nTest'} | ${"The maximum length of a line is 20 characters."}
130+
${'customization.reports.header'} | ${'Testing maximum length of a line of 40 characters\nTest'} | ${"The maximum length of a line is 40 characters."}
131131
${'disabled_roles'} | ${['test']} | ${undefined}
132132
${'disabled_roles'} | ${['']} | ${'Value can not be empty.'}
133133
${'disabled_roles'} | ${['test space']} | ${"No whitespaces allowed."}

server/lib/reporting/printer.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ const pageConfiguration = ({ pathToLogo, pageHeader, pageFooter }) => ({
6262
text: pageHeader,
6363
alignment: 'right',
6464
margin: [0, 0, 40, 0],
65-
color: COLORS.PRIMARY
65+
color: COLORS.PRIMARY,
66+
width: 'auto'
6667
}
6768
]
6869
},
@@ -79,7 +80,8 @@ const pageConfiguration = ({ pathToLogo, pageHeader, pageFooter }) => ({
7980
text: 'Page ' + currentPage.toString() + ' of ' + pageCount,
8081
alignment: 'right',
8182
margin: [0, 40, 40, 0],
82-
color: COLORS.PRIMARY
83+
color: COLORS.PRIMARY,
84+
width: 'auto'
8385
}
8486
]
8587
};

server/routes/wazuh-utils/wazuh-utils.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -310,13 +310,13 @@ hosts:
310310
${'customization.reports.footer'} | ${'Test\nTest'} | ${200} | ${null}
311311
${'customization.reports.footer'} | ${'Test\nTest\nTest\nTest\nTest'} | ${400} | ${"[request body.customization.reports.footer]: The string should have less or equal to 2 line/s."}
312312
${'customization.reports.footer'} | ${'Line with 30 characters \nTest'} | ${200} | ${undefined}
313-
${'customization.reports.footer'} | ${'Line with 31 characters \nTest'} | ${400} | ${"[request body.customization.reports.footer]: The maximum length of a line is 30 characters."}
313+
${'customization.reports.footer'} | ${'Testing the maximum length of a line of 50 characters\nTest'}| ${400} | ${"[request body.customization.reports.footer]: The maximum length of a line is 50 characters."}
314314
${'customization.reports.footer'} | ${true} | ${400} | ${'[request body.customization.reports.footer]: expected value of type [string] but got [boolean]'}
315315
${'customization.reports.header'} | ${'Test'} | ${200} | ${null}
316316
${'customization.reports.header'} | ${'Test\nTest'} | ${200} | ${null}
317317
${'customization.reports.header'} | ${'Test\nTest\nTest\nTest\nTest'} | ${400} | ${"[request body.customization.reports.header]: The string should have less or equal to 3 line/s."}
318318
${'customization.reports.header'} | ${'Line with 20 charact\nTest'} | ${200} | ${undefined}
319-
${'customization.reports.header'} | ${'Line with 23 characters\nTest'} | ${400} | ${"[request body.customization.reports.header]: The maximum length of a line is 20 characters."}
319+
${'customization.reports.header'} | ${'Testing maximum length of a line of 40 characters\nTest'} | ${400} | ${"[request body.customization.reports.header]: The maximum length of a line is 40 characters."}
320320
${'customization.reports.header'} | ${true} | ${400} | ${'[request body.customization.reports.header]: expected value of type [string] but got [boolean]'}
321321
${'disabled_roles'} | ${['test']} | ${200} | ${null}
322322
${'disabled_roles'} | ${['']} | ${400} | ${'[request body.disabled_roles.0]: Value can not be empty.'}

0 commit comments

Comments
 (0)