From 4fb69040a0a9749ef8a83ffccf1bc39c648421ba Mon Sep 17 00:00:00 2001 From: Walter Rafelsberger Date: Tue, 25 Feb 2020 19:50:07 +0100 Subject: [PATCH] [ML] http service cleanup. --- .../transform/public/app/hooks/index.ts | 1 + .../{services/http => hooks}/use_request.ts | 4 ++-- .../components/authorization_provider.tsx | 2 +- .../transform/public/app/services/http/http.ts | 18 ------------------ .../public/app/services/http/index.ts | 6 ------ 5 files changed, 4 insertions(+), 27 deletions(-) rename x-pack/legacy/plugins/transform/public/app/{services/http => hooks}/use_request.ts (84%) delete mode 100644 x-pack/legacy/plugins/transform/public/app/services/http/http.ts delete mode 100644 x-pack/legacy/plugins/transform/public/app/services/http/index.ts diff --git a/x-pack/legacy/plugins/transform/public/app/hooks/index.ts b/x-pack/legacy/plugins/transform/public/app/hooks/index.ts index 7981f560a525f..a36550bcd8e57 100644 --- a/x-pack/legacy/plugins/transform/public/app/hooks/index.ts +++ b/x-pack/legacy/plugins/transform/public/app/hooks/index.ts @@ -9,3 +9,4 @@ export { useGetTransforms } from './use_get_transforms'; export { useDeleteTransforms } from './use_delete_transform'; export { useStartTransforms } from './use_start_transform'; export { useStopTransforms } from './use_stop_transform'; +export { useRequest } from './use_request'; diff --git a/x-pack/legacy/plugins/transform/public/app/services/http/use_request.ts b/x-pack/legacy/plugins/transform/public/app/hooks/use_request.ts similarity index 84% rename from x-pack/legacy/plugins/transform/public/app/services/http/use_request.ts rename to x-pack/legacy/plugins/transform/public/app/hooks/use_request.ts index 2816c66f3afbf..8c489048a77ef 100644 --- a/x-pack/legacy/plugins/transform/public/app/services/http/use_request.ts +++ b/x-pack/legacy/plugins/transform/public/app/hooks/use_request.ts @@ -4,9 +4,9 @@ * you may not use this file except in compliance with the Elastic License. */ -import { UseRequestConfig, useRequest as _useRequest } from '../../../shared_imports'; +import { UseRequestConfig, useRequest as _useRequest } from '../../shared_imports'; -import { useAppDependencies } from '../../app_dependencies'; +import { useAppDependencies } from '../app_dependencies'; export const useRequest = (config: UseRequestConfig) => { const { diff --git a/x-pack/legacy/plugins/transform/public/app/lib/authorization/components/authorization_provider.tsx b/x-pack/legacy/plugins/transform/public/app/lib/authorization/components/authorization_provider.tsx index 23ff66e9be159..dde63710f56aa 100644 --- a/x-pack/legacy/plugins/transform/public/app/lib/authorization/components/authorization_provider.tsx +++ b/x-pack/legacy/plugins/transform/public/app/lib/authorization/components/authorization_provider.tsx @@ -5,7 +5,7 @@ */ import React, { createContext } from 'react'; -import { useRequest } from '../../../services/http/use_request'; +import { useRequest } from '../../../hooks'; import { hasPrivilegeFactory, Capabilities, Privileges } from './common'; interface Authorization { diff --git a/x-pack/legacy/plugins/transform/public/app/services/http/http.ts b/x-pack/legacy/plugins/transform/public/app/services/http/http.ts deleted file mode 100644 index 71c5cdaf685b4..0000000000000 --- a/x-pack/legacy/plugins/transform/public/app/services/http/http.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ -class HttpService { - private client: any; - - public init(httpClient: any): void { - this.client = httpClient; - } - - public get httpClient(): any { - return this.client; - } -} - -export const httpService = new HttpService(); diff --git a/x-pack/legacy/plugins/transform/public/app/services/http/index.ts b/x-pack/legacy/plugins/transform/public/app/services/http/index.ts deleted file mode 100644 index a129998e48e1f..0000000000000 --- a/x-pack/legacy/plugins/transform/public/app/services/http/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ -export { httpService } from './http';