[ML] New Platform server shim: update annotation routes to use new platform router #57067
Conversation
|
Pinging @elastic/ml-ui (:ml) |
💔 Build Failed
Test FailuresKibana Pipeline / x-pack-intake-agent / X-Pack Jest Tests.x-pack/legacy/plugins/ml/server/models/annotation_service.annotation_service deleteAnnotation() should delete annotationStandard OutStack TraceKibana Pipeline / x-pack-intake-agent / X-Pack Jest Tests.x-pack/legacy/plugins/ml/server/models/annotation_service.annotation_service getAnnotation() should get annotations for specific jobStandard OutStack TraceKibana Pipeline / x-pack-intake-agent / X-Pack Jest Tests.x-pack/legacy/plugins/ml/server/models/annotation_service.annotation_service getAnnotation() should throw and catch an errorStandard OutStack Traceand 3 more failures, only showing the first 3. To update your PR or re-run it, just comment with: |
walterra
left a comment
There was a problem hiding this comment.
Looks good overall, just added some questions/suggestions.
There was a problem hiding this comment.
Can we work around this in another way? The styleguide says to avoid non-null assertions https://github.com/elastic/kibana/blob/master/STYLEGUIDE.md#avoid-non-null-assertions
There was a problem hiding this comment.
I agree, this has been bothering me too in the recent NP work.
Does ml need to be optional in our RequestHandlerContext interface? especially as we're asserting that it isn't optional in every route.
There was a problem hiding this comment.
Adding ml to the RequestHandlerContext interface was initially made optional to prevent issues with other plugins using RequestHandlerContext. This was the suggested definition from kibana-platform.
Had a chat with Josh about this and looks like they'll be improving this by adding a generic type arg to core.http.createRouter so you can specify your own type for RequestHandlerContext. The PR should be up soon. Then we'll be able to get rid of the non-null assertions. 🙌
So we're stuck with this for now but once that PR is in we can add the change in the next routes PR 👌
There was a problem hiding this comment.
What do you think of moving all schema definitions to new_platform/annotations_schema.ts for consistency even if they are not as complex as the indexAnnotationSchema one?
There was a problem hiding this comment.
What do you think of moving all schema definitions to new_platform/annotations_schema.ts for consistency even if they are not as complex as the indexAnnotationSchema one?
f059e07 to
a3b489d
Compare
There was a problem hiding this comment.
Looks like this is no longer available in the NP request object. It has to be accessed via the NP security plugin api - added in a4ad5a5039fd1c809bbb121a9bc327a63ce8a53b
peteharverson
left a comment
There was a problem hiding this comment.
Tested latest edits and LGTM
|
Thanks, everyone, for taking a look 😄 This is ready for a final check when you get a chance! cc @jgowdyelastic, @walterra |
a4ad5a5 to
8a9892a
Compare
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
…atform router (elastic#57067) * update annotation routes to use NP router * create ts file for feature check * update schema to allow null value for earliest/latestMs * update annotations model test * use NP security plugin to access user info
* master: (27 commits) Include actions new platform plugin for codeowners (elastic#57252) [APM][docs] 7.6 documentation updates (elastic#57124) Expressions refactor (elastic#54342) [ML] New Platform server shim: update annotation routes to use new platform router (elastic#57067) Remove injected ui app vars from Canvas (elastic#56190) update max_anomaly_score route schema to handle possible undefined values (elastic#57339) [Add panel flyout] Moving create new to the top of SavedObjectFinder (elastic#56428) Add mock of a legacy ui api to re-enable Canvas storybook (elastic#56673) [monitoring] Removes noisy event received log (elastic#57275) Remove use of copied MANAGEMENT_BREADCRUMBS and use `setBreadcrumbs` from management section's mount (elastic#57324) Advanced Settings management app to kibana platform plugin (elastic#56931) [ML] New Platform server shim: update recognize modules routes to use new platform router (elastic#57206) [ML] Fix overall stats for saved search on the Data Visualizer page (elastic#57312) [ML] [NP] Removing ui imports (elastic#56358) [SIEM] Fixes failing Cypress tests (elastic#57202) Create observability CODEOWNERS reference (elastic#57109) fix results service schema (elastic#57217) don't register a wrapper if browser side function exists. (elastic#57196) Ui Actions explorer example (elastic#57006) Fix update alert API to still work when AAD is out of sync (elastic#57039) ...


Summary
Updates all annotation routes to use new platform router.
Checklist
Delete any items that are not applicable to this PR.