mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
parent
09745e2c01
commit
dbac10cdf9
3 changed files with 14 additions and 12 deletions
|
@ -18,11 +18,11 @@
|
|||
*/
|
||||
|
||||
import React, { useContext } from 'react';
|
||||
import { CoreSetupContext } from '../contexts/query_input_bar_context';
|
||||
import { CoreStartContext } from '../contexts/query_input_bar_context';
|
||||
import { QueryBarInput } from 'plugins/data';
|
||||
|
||||
export function QueryBarWrapper(props) {
|
||||
const coreSetupContext = useContext(CoreSetupContext);
|
||||
const coreStartContext = useContext(CoreStartContext);
|
||||
|
||||
return <QueryBarInput {...props} {...coreSetupContext} />;
|
||||
return <QueryBarInput {...props} {...coreStartContext} />;
|
||||
}
|
||||
|
|
|
@ -31,9 +31,9 @@ import { brushHandler } from '../lib/create_brush_handler';
|
|||
import { fetchFields } from '../lib/fetch_fields';
|
||||
import { extractIndexPatterns } from '../../common/extract_index_patterns';
|
||||
|
||||
import { npSetup } from 'ui/new_platform';
|
||||
import { npStart } from 'ui/new_platform';
|
||||
import { Storage } from 'ui/storage';
|
||||
import { CoreSetupContextProvider } from '../contexts/query_input_bar_context';
|
||||
import { CoreStartContextProvider } from '../contexts/query_input_bar_context';
|
||||
const localStorage = new Storage(window.localStorage);
|
||||
|
||||
const VIS_STATE_DEBOUNCE_DELAY = 200;
|
||||
|
@ -59,7 +59,8 @@ export class VisEditor extends Component {
|
|||
// core dependencies required by React components downstream.
|
||||
this.coreContext = {
|
||||
appName: APP_NAME,
|
||||
uiSettings: npSetup.core.uiSettings,
|
||||
uiSettings: npStart.core.uiSettings,
|
||||
savedObjectsClient: npStart.core.savedObjects.client,
|
||||
store: localStorage,
|
||||
};
|
||||
}
|
||||
|
@ -181,7 +182,7 @@ export class VisEditor extends Component {
|
|||
onDataChange={this.onDataChange}
|
||||
/>
|
||||
<div className="tvbEditor--hideForReporting">
|
||||
<CoreSetupContextProvider value={this.coreContext}>
|
||||
<CoreStartContextProvider value={this.coreContext}>
|
||||
<PanelConfig
|
||||
fields={this.state.visFields}
|
||||
model={model}
|
||||
|
@ -190,7 +191,7 @@ export class VisEditor extends Component {
|
|||
onChange={this.handleChange}
|
||||
getConfig={this.getConfig}
|
||||
/>
|
||||
</CoreSetupContextProvider>
|
||||
</CoreStartContextProvider>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -19,14 +19,15 @@
|
|||
|
||||
import React from 'react';
|
||||
import { Storage } from 'ui/storage';
|
||||
import { UiSettingsClientContract } from 'src/core/public';
|
||||
import { UiSettingsClientContract, SavedObjectsClientContract } from 'src/core/public';
|
||||
|
||||
export interface ICoreSetupContext {
|
||||
export interface ICoreStartContext {
|
||||
appName: string;
|
||||
uiSettings: UiSettingsClientContract;
|
||||
savedObjectsClient: SavedObjectsClientContract;
|
||||
store: Storage;
|
||||
}
|
||||
|
||||
export const CoreSetupContext = React.createContext<ICoreSetupContext | null>(null);
|
||||
export const CoreStartContext = React.createContext<ICoreStartContext | null>(null);
|
||||
|
||||
export const CoreSetupContextProvider = CoreSetupContext.Provider;
|
||||
export const CoreStartContextProvider = CoreStartContext.Provider;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue