-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Prevent creating a job in the reporting index when the type is immediate #35011
Conversation
x-pack/plugins/reporting/export_types/csv_from_savedobject/server/execute_job.ts
Show resolved
Hide resolved
@@ -6,8 +6,6 @@ | |||
|
|||
import { badRequest } from 'boom'; | |||
import { Request } from 'hapi'; | |||
// @ts-ignore | |||
import { createTaggedLogger } from '../../../../server/lib'; |
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.
Cleanup, this was invalid but it had ts-ignore
@@ -20,7 +20,7 @@ export interface SavedSearchGeneratorResult { | |||
|
|||
export interface CsvResultFromSearch { | |||
type: string; | |||
result: SavedSearchGeneratorResult | null; | |||
result: SavedSearchGeneratorResult; |
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.
It made things complicated to try to support this being null
, since the value gets passed in h.response
in the route handler, and h.response
does not accept null
per TS types.
That is why, further down, the code will check if this is null and convert to undefined
f9d25de
to
eff1dbb
Compare
eff1dbb
to
0bdbf93
Compare
@@ -0,0 +1,51 @@ | |||
/* | |||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one |
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.
Added this change for CI to pass. These changes come from #34972
This comment has been minimized.
This comment has been minimized.
…/reporting/csv-export-panel-action-no-job-create-for-immediate
This comment has been minimized.
This comment has been minimized.
…/reporting/csv-export-panel-action-no-job-create-for-immediate
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
💚 Build Succeeded |
3334140
to
4446428
Compare
61c1c1b
into
elastic:feature/reporting/csv-export-panel-action
Summary
In the implementation of "immediate" generation of CSV from a saved object, work is done in the "immediate" route handler to craft a job document for the .reporting index, and make sure the generated CSV contents are stored in the index for later re-download.
This has a lot of downsides:
generateCsv
would be called in 2 places: createJob (immediate only) and executeJob (non-immediate only)This PR has the "immediate" route handler calls
createJob
andexecuteJob
directly, not through the helper function that uses ESQueue to create the document in ES. Those functions analyze the request and look up the saved object details for metadata used for generating the content immediately - which now will only happen fromexecuteJob