Skip to content

Commit

Permalink
[ML] resolve PR review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
darnautov committed Jun 17, 2020
1 parent 5eb6b45 commit 87faf26
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ interface StartPlugins {
data: DataPublicPluginStart;
security?: SecurityPluginSetup;
licenseManagement?: LicenseManagementUIPluginSetup;
kibanaVersion: string;
share: SharePluginStart;
}
export type StartServices = CoreStart & StartPlugins;
export type StartServices = CoreStart & StartPlugins & { kibanaVersion: string };
// eslint-disable-next-line react-hooks/rules-of-hooks
export const useMlKibana = () => useKibana<StartServices>();
export type MlKibanaReactContextValue = KibanaReactContextValue<StartServices>;
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ function getFetchOptions(
/**
* Function for making HTTP requests to Kibana's backend.
* Wrapper for Kibana's HttpHandler.
*
* @deprecated use {@link HttpService} instead
*/
export async function http<T>(options: HttpFetchOptionsWithPath): Promise<T> {
const { path, fetchOptions } = getFetchOptions(options);
Expand All @@ -46,6 +48,8 @@ export async function http<T>(options: HttpFetchOptionsWithPath): Promise<T> {
/**
* Function for making HTTP requests to Kibana's backend which returns an Observable
* with request cancellation support.
*
* @deprecated use {@link HttpService} instead
*/
export function http$<T>(options: HttpFetchOptionsWithPath): Observable<T> {
const { path, fetchOptions } = getFetchOptions(options);
Expand All @@ -55,7 +59,7 @@ export function http$<T>(options: HttpFetchOptionsWithPath): Observable<T> {
/**
* Creates an Observable from Kibana's HttpHandler.
*/
export function fromHttpHandler<T>(input: string, init?: RequestInit): Observable<T> {
function fromHttpHandler<T>(input: string, init?: RequestInit): Observable<T> {
return new Observable<T>((subscriber) => {
const controller = new AbortController();
const signal = controller.signal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ export function basePath() {
return '/api/ml';
}

/**
* Temp solution to allow {@link ml} service to use http from
* the dependency_cache.
*/
const proxyHttpStart = new Proxy<HttpStart>(({} as unknown) as HttpStart, {
get(obj, prop: keyof HttpStart) {
try {
Expand Down

0 comments on commit 87faf26

Please sign in to comment.