-
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
[ML] Typescripting client side endpoint functions #59928
[ML] Typescripting client side endpoint functions #59928
Conversation
Pinging @elastic/ml-ui (:ml) |
8344c47
to
59e7c79
Compare
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, just added suggestion about adding types for data frame analytics endpoints.
method: 'GET', | ||
}); | ||
}, | ||
createDataFrameAnalytics(analyticsId: string, analyticsConfig: any) { |
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.
You could use DataFrameAnalyticsConfig
from data_frame_analytics/common/analytics.ts
maybe?
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.
the places where createDataFrameAnalytics
is called aren't supplying a DataFrameAnalyticsConfig
object.
It looks like a DeepPartial<DataFrameAnalyticsConfig>
.
I've updated the expected type to be DeepPartial<DataFrameAnalyticsConfig>
.
body, | ||
}); | ||
}, | ||
explainDataFrameAnalytics(jobConfig: any) { |
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.
You could use DataFrameAnalyticsConfig
from data_frame_analytics/common/analytics.ts
maybe?
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 also needs to be a DeepPartial<DataFrameAnalyticsConfig>
body, | ||
}); | ||
}, | ||
evaluateDataFrameAnalytics(evaluateConfig: any) { |
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.
You could use DataFrameAnalyticsConfig
from data_frame_analytics/common/analytics.ts
maybe?
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 looks the evaluate config is something different altogether. without wanting to create a new type here, i'm going to leave this as any
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
060b9a0
to
3ecbba2
Compare
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.
Tested and LGTM
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
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 ⚡️
* [ML] Typescripting client side endpoint functions * type clean up * cleaning up http requests * remove http generics * better use of generics and type clean up * removes some generics * update comment * updating data frame analytics types * fixing type errors
* master: (45 commits) skip flaky suite (elastic#59717) UI Metrics use findAll to retrieve all Saved Objects (elastic#59891) [Discover] Migrate Context mocha tests to use Jest (elastic#59658) [Maps] Move redux reducers and store logic to NP (elastic#58294) rebalance x-pack groups (elastic#58930) [Discover] Reimplement $route.reload when index pattern changes (elastic#59877) [Upgrade Assistant Meta] Breaking changes issue template (elastic#59745) Skip CI based on changes in PR (elastic#59939) [ML] Transforms: Replace KqlFilterBar with QueryStringInput. (elastic#59723) [ML] Functional tests - stabilize date_nanos test (elastic#59986) [ML] Typescripting client side endpoint functions (elastic#59928) a11y tests on adding columns to discover table (elastic#59375) fix graph plugin config path (elastic#59540) fix vega config issues (elastic#59737) [Upgrade Assistant] Open And Close Slight Refactor (elastic#59890) [ML] Adding shared services to ml setup contract (elastic#59730) [Visualize] Fix linked search behavior (elastic#59690) [ML] Register NP ML plugin for Kibana management section. (elastic#59762) [Lens] Adds using queries/filters for field existence endpoint (elastic#59033) Delete FilterStateManager and QueryFilter :-D (elastic#59872) ...
Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync. |
* [ML] Typescripting client side endpoint functions * type clean up * cleaning up http requests * remove http generics * better use of generics and type clean up * removes some generics * update comment * updating data frame analytics types * fixing type errors Co-authored-by: Elastic Machine <[email protected]>
Most endpoint functions either return
Promise<any>
orPromise<specific type>
where the type is defined in or imported into the file.Future work is needed to complete these missing types so none of the functions return an
any
.It would also be good to restructure the index.ts file to split it up into smaller files. It was the original endpoint file and so has grown to be very large and contains a variety of functions which could go into separate sub sections.