mirror of
https://github.com/elastic/kibana.git
synced 2025-06-28 11:05:39 -04:00
- Moves duplicates of `DatePickerWrapper` and related code to package `@kbn/ml-date-picker`. The duplicated components across the code base have been consolidated and diverging features combined. Each duplicate has been checked with a diff against the package before deletion. - Moves duplicates of `query_utils.ts` to a package `@kbn/ml-query_utils`. - Some jest test were migrated from enzyme to react-testing-lib. - `i18n` strings and data-test-subjects have been updated to be prefixes in line with package names. - Replaces custom code related to the `compact` flag with EUI's breakpoints.
25 lines
841 B
TypeScript
25 lines
841 B
TypeScript
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
* 2.0.
|
|
*/
|
|
|
|
import { createContext, useContext } from 'react';
|
|
import { DataView } from '@kbn/data-views-plugin/common';
|
|
import { SavedSearch } from '@kbn/saved-search-plugin/public';
|
|
import { SavedSearchSavedObject } from '../application/utils/search_utils';
|
|
|
|
export const DataSourceContext = createContext<{
|
|
dataView: DataView | never;
|
|
savedSearch: SavedSearch | SavedSearchSavedObject | null;
|
|
}>({
|
|
get dataView(): never {
|
|
throw new Error('DataSourceContext is not implemented');
|
|
},
|
|
savedSearch: null,
|
|
});
|
|
|
|
export function useDataSource() {
|
|
return useContext(DataSourceContext);
|
|
}
|