Skip to content

Commit 84203df

Browse files
committed
[ML] Use setDependencyCache to initialize http when using DataLoader via transforms.
1 parent 0984587 commit 84203df

3 files changed

Lines changed: 11 additions & 0 deletions

File tree

x-pack/plugins/ml/public/shared.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ export * from './application/data_frame_analytics/common';
2222
export * from './application/util/date_utils';
2323

2424
export { DataLoader } from './application/datavisualizer/index_based/data_loader';
25+
export { clearCache, setDependencyCache } from './application/util/dependency_cache';

x-pack/plugins/transform/public/app/app.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import { KibanaContextProvider } from '../../../../../src/plugins/kibana_react/p
1515

1616
import { API_BASE_PATH } from '../../common/constants';
1717

18+
import { clearCache, setDependencyCache } from '../shared_imports';
19+
1820
import { SectionError } from './components';
1921
import { SECTION_SLUG } from './constants';
2022
import { AuthorizationContext, AuthorizationProvider } from './lib/authorization';
@@ -60,6 +62,11 @@ export const App: FC<{ history: ScopedHistory }> = ({ history }) => {
6062
};
6163

6264
export const renderApp = (element: HTMLElement, appDependencies: AppDependencies) => {
65+
// TODO Temporary fix to make the Data Grid Histograms in the Transforms Wizard work
66+
setDependencyCache({
67+
http: appDependencies.http,
68+
});
69+
6370
const I18nContext = appDependencies.i18n.Context;
6471

6572
render(
@@ -75,5 +82,6 @@ export const renderApp = (element: HTMLElement, appDependencies: AppDependencies
7582

7683
return () => {
7784
unmountComponentAtNode(element);
85+
clearCache();
7886
};
7987
};

x-pack/plugins/transform/public/shared_imports.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ export {
1414
} from '../../../../src/plugins/es_ui_shared/public';
1515

1616
export {
17+
clearCache,
1718
getFieldType,
1819
getErrorMessage,
1920
extractErrorMessage,
2021
formatHumanReadableDateTimeSeconds,
2122
getDataGridSchemaFromKibanaFieldType,
2223
getFieldsFromKibanaIndexPattern,
2324
multiColumnSortFactory,
25+
setDependencyCache,
2426
showDataGridColumnChartErrorMessageToast,
2527
useDataGrid,
2628
useRenderCellValue,

0 commit comments

Comments
 (0)