-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Reporting] Use spaceId from request in export generation #76998
Conversation
dd19128
to
9ef809a
Compare
// This is used by the spaces SavedObjectClientWrapper to determine the existing space. | ||
// We use the basePath from the saved job, which we'll have post spaces being implemented; | ||
// or we use the server base path, which uses the default space | ||
getBasePath: () => job.basePath || serverBasePath, |
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.
This is the no-longer-working code for supporting spaces in our UI Settings clients.
a16c44c
to
baafb3f
Compare
1acd05e
to
1953026
Compare
x-pack/plugins/reporting/server/export_types/printable_pdf/execute_job/index.ts
Show resolved
Hide resolved
1953026
to
d041bc4
Compare
mergeMap((conditionalHeaders) => | ||
getCustomLogo({ reporting, config, job, conditionalHeaders }) | ||
), | ||
mergeMap((conditionalHeaders) => getCustomLogo(reporting, conditionalHeaders, job.spaceId)), |
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.
I refactored getCustomLogo
to receive more specific parameters. The other common helper functions here could probably use the same thing
Pinging @elastic/kibana-reporting-services (Team:Reporting Services) |
…/get_custom_logo.ts Co-authored-by: Joel Griffith <joel@joelgriffith.net>
if (spacesService) { | ||
if (spaceId && spaceId !== DEFAULT_SPACE_ID) { | ||
this.logger.info(`Generating request for space: ` + spaceId); | ||
this.getPluginSetupDeps().basePath.set(fakeRequest, `/s/${spaceId}`); |
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.
cc @jportner Thanks for your help in figuring this part out! Please take a look at how I am using your advice and let me know if you have any thoughts about it.
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.
As discussed offline -- looks great!
@elasticmachine merge upstream |
) * [Reporting] Use spaceId from request in export generation * remove todo that has been done * whitespace * use post params api in test * add logging to core * Update x-pack/plugins/reporting/server/export_types/printable_pdf/lib/get_custom_logo.ts Co-authored-by: Joel Griffith <joel@joelgriffith.net> * more logging * fix interdependence and remove Promise.all * getAbsoluteUrl have only 1 way to provide basePath * --wip-- [skip ci] * log apipath * deleteAllReports at the end * tests pass locally * set config in the tests * re-add skips of flaky tests * test using csv:quoteValues Co-authored-by: Joel Griffith <joel@joelgriffith.net> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
💛 Build succeeded, but was flaky
Test FailuresX-Pack APM API integration tests (basic).x-pack/test/apm_api_integration/basic/tests/metrics_charts/metrics_charts·ts.APM specs (basic) Metrics when data is loaded for opbeans-node returns metrics data CPU usage has correct series overall valuesStandard Out
Stack Trace
Build metricsdistributable file count
History
To update your PR or re-run it, just comment with: |
…77952) * [Reporting] Use spaceId from request in export generation * remove todo that has been done * whitespace * use post params api in test * add logging to core * Update x-pack/plugins/reporting/server/export_types/printable_pdf/lib/get_custom_logo.ts Co-authored-by: Joel Griffith <joel@joelgriffith.net> * more logging * fix interdependence and remove Promise.all * getAbsoluteUrl have only 1 way to provide basePath * --wip-- [skip ci] * log apipath * deleteAllReports at the end * tests pass locally * set config in the tests * re-add skips of flaky tests * test using csv:quoteValues Co-authored-by: Joel Griffith <joel@joelgriffith.net> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Joel Griffith <joel@joelgriffith.net> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Summary
Release note: Fixed the reporting exports to use the correct Space for advanced settings.
Explanation:
Reporting builds a
fakeRequest
object to use as a source that provides UI Settings. If the request does not have the space ID baked in, the settings will always come from the default space.Right now, none of the fake request objects have a space ID baked in, so the default space settings are always used. This affects:
csv:separator
andcsv:quoteValues
are space-specific settingsxpackReporting:customPdfLogo
is space-specificThis PR captures the spaceId from the request at job creation time. It plays into the fakeRequest objects at job execution time using:
It replaces code from a very old PR that incorporated the
basePath
of the request URL to determine the space ID. It then would incorporate the spaceId into fake requests by adding agetBasePath
method, which was expected to return the space ID along with the base path. In the new platform, there is nogetBasePath
method ofKibanaRequest
, which makes the basePath handling on the server side useless. This PR removes thebasePath
field from job params since it isn't useful to receive it.Fix #68076
Fix #70175
Fix: PDF Logo is always taken from default space
Checklist
Delete any items that are not applicable to this PR.
For maintainers