Skip to content

Commit cab9883

Browse files
authored
[Reporting] re-allow multi-page Canvas reports (#255022)
resolves #252838 ## Summary A previous PR - #245330 - added an incorrect validation on the `locatorParams` parameter, of a maximum of one entry in the array. Previously there was no limit. Canvas uses multiple `locatorParams` for multi-page workpads, and so these ended up failing the validation, and would not generate a report. This PR changes the limit from 1 to 100. The validation was added in 9.3.0, so only needs to be backported to the 9.3 branch ... ### To Verify Create a multi-page Canvas workpad, and generate a PDF for it. Canvas is not enabled in Kibana by default, anymore, but some instructions to enable it are here: https://support.elastic.co/knowledge/9f434635 ## Release note Fixes a problem generating a report with multi-page Canvas workpads. ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels.
1 parent 40cac4c commit cab9883

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

x-pack/platform/plugins/private/reporting/server/routes/common/request_handler/validator.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,4 +365,21 @@ describe('validateJobParams', () => {
365365
]"
366366
`);
367367
});
368+
369+
it('validates multiple locator params', () => {
370+
const validParams = {
371+
title: 'Monthly Report',
372+
version: '8.0.0',
373+
layout: {
374+
id: idSchema.Enum.print,
375+
dimensions: { width: 800, height: 600 },
376+
},
377+
browserTimezone: 'UTC',
378+
objectType: 'dashboard',
379+
forceNow: '2024-01-01T00:00:00',
380+
locatorParams: [{ id: 'some-id' }, { version: 'some-version' }],
381+
} as unknown as BaseParams;
382+
383+
expect(() => validateJobParams(validParams)).not.toThrow();
384+
});
368385
});

x-pack/platform/plugins/private/reporting/server/routes/common/request_handler/validator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const locatorObjectSchema = z.object({
9595
params: z.record(z.any()).optional(),
9696
});
9797

98-
const locatorParamsSchema = z.array(locatorObjectSchema).max(1).or(locatorObjectSchema);
98+
const locatorParamsSchema = z.array(locatorObjectSchema).max(100).or(locatorObjectSchema);
9999

100100
const relativeUrlSchema = z.string().max(4096);
101101
const relativeUrlsSchema = z.array(relativeUrlSchema).max(100);

0 commit comments

Comments
 (0)