Skip to content

Commit

Permalink
fixed failure due to missing fail object client (#44573) (#44612)
Browse files Browse the repository at this point in the history
  • Loading branch information
Liza Katz authored Sep 2, 2019
1 parent 09745e2 commit dbac10c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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} />;
}
11 changes: 6 additions & 5 deletions src/legacy/core_plugins/metrics/public/components/vis_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
};
}
Expand Down Expand Up @@ -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}
Expand All @@ -190,7 +191,7 @@ export class VisEditor extends Component {
onChange={this.handleChange}
getConfig={this.getConfig}
/>
</CoreSetupContextProvider>
</CoreStartContextProvider>
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit dbac10c

Please sign in to comment.