-
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
[Reporting]: Move router + license checks to new platform #66331
[Reporting]: Move router + license checks to new platform #66331
Conversation
await pluginInstance.setup(coreSetup, { | ||
elasticsearch: coreSetup.elasticsearch, | ||
security: server.newPlatform.setup.plugins.security as SecurityPluginSetup, | ||
usageCollection: server.newPlatform.setup.plugins.usageCollection, | ||
__LEGACY, | ||
licensing: { |
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.
Need to verify this is working properly as I'm not fully versed on how this works
@@ -35,7 +34,7 @@ export function enqueueJobFactory(reporting: ReportingCore, parentLogger: Logger | |||
return async function enqueueJob<JobParamsType>( | |||
exportTypeId: string, | |||
jobParams: JobParamsType, | |||
user: string, | |||
username: string, |
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.
Change here helped me tighten down types in downstream modules
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.
just a few small nits :)
Ack: will review tomorrow. |
@@ -27,6 +27,7 @@ export const WHITELISTED_JOB_CONTENT_TYPES = [ | |||
'application/pdf', | |||
CONTENT_TYPE_CSV, | |||
'image/png', | |||
'text/plain', |
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 needed now so we can pass long certain job-status messages (they were incorrectly being sent as application/json, and I think hapi was fixing that under-the-hood)
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
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.
Needed since new config schema doesn't have an API for this
Pushed up a larger delta for job-status tests, still more that needs to be done but the rest should be relatively quick since we have patterns in place for how to do this. |
…ffith/kibana into chore/np-route-migration
x-pack/legacy/plugins/reporting/server/routes/generation.test.ts
Outdated
Show resolved
Hide resolved
x-pack/legacy/plugins/reporting/server/routes/generation.test.ts
Outdated
Show resolved
Hide resolved
import { JobParamsPDF } from '../../types'; | ||
|
||
export const createJobFactory: CreateJobFactory<ESQueueCreateJobFn< | ||
JobParamsPDF | ||
>> = function createJobFactoryFn(reporting: ReportingCore) { | ||
>> = function createJobFactoryFn(reporting) { |
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.
Thank you for cleaning up this inferrable types!
@@ -46,30 +48,10 @@ export class ReportingCore { | |||
private readonly pluginStart$ = new Rx.ReplaySubject<ReportingInternalStart>(); | |||
private exportTypesRegistry = getExportTypesRegistry(); | |||
|
|||
constructor(private logger: LevelLogger, private config: ReportingConfig) {} | |||
|
|||
legacySetup( |
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.
🎉
Once this is green, my plan is to:
|
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.
LGTM
Thank you SO much for the work you have put into this, @joelgriffith. This PR a major, major improvement.
Approved elsewhere, not sure why GH is having this block merge
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
Backport [7.9]: #67818 |
…) (#67818) * [Reporting]: Move router + license checks to new platform (#66331) * WIP: Move routes to new API, license and other checks inbound * Move license checks over to np licensing observable * Fix license checks + remove older modules * Fixing check_license tests, move to TS/Jest * Fix licensing setup for mocks * Move job.test.ts over to np * WIP: move user checks to higher-order func * Move more handler logic over to Response factory vs Boom * Major refactor to consolidate types, remove facades, and udpate helpers * Fix validation for dates in immediate exports * Linter fix on check license test * Fix job generation tests * Move deps => setupDeps * fix api test * fix jobs test * authorized_user_pre_routing and tests * Fixing duplicate identifiers * Fix licensing implementation changes * WIP: Moving license over to async/observables * Fix disabled-security case * finish auth_user_pre_routing cleanup - no more license check * WIP: Fixing final api tests * Trying to get schema differences in alignment * Reverting back to previous generation handler * Fix final API tests * Final API test fixes, few more hardening tests and better error messages * Simplify lower-level module implementation (core only interface) + test updates * Push some core logic into plugin * Move some core logic up to plugin * Marking private setupDeps + downstream fixes * revert logger as a param Co-authored-by: Timothy Sullivan <tsullivan@elastic.co> # Conflicts: # x-pack/legacy/plugins/reporting/export_types/printable_pdf/server/create_job/index.ts # x-pack/legacy/plugins/reporting/server/routes/generation.ts * Add back in legacy /viz /search and /dashboard routes * Add back in and fix compatibility shim/tests
Moves our routes and relevant factories/classes to new platform idioms. Most of the fundamental pieces are in place, but there is still work needing to be done: