Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed TSVB Panel Options failure #44573

Merged
merged 1 commit into from
Sep 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;