Skip to content
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
2 changes: 1 addition & 1 deletion src/legacy/core_plugins/data/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export {
IndexPatterns,
StaticIndexPattern,
} from './index_patterns';
export { Query, QueryBar, QueryBarInput } from './query';
export { Query, QueryBarInput } from './query';
export { SearchBar, SearchBarProps, SavedQueryAttributes, SavedQuery } from './search';

/** @public static code */
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import { mockPersistedLogFactory } from './query_bar_input.test.mocks';

import React from 'react';
import { shallowWithIntl } from 'test_utils/enzyme_helpers';
import './query_bar.test.mocks';
import { QueryBar } from './query_bar';
import './query_bar_top_row.test.mocks';
import { QueryBarTopRow } from './query_bar_top_row';
import { IndexPattern } from '../../../index';

import { coreMock } from '../../../../../../../core/public/mocks';
Expand Down Expand Up @@ -88,7 +88,7 @@ const mockIndexPattern = {
],
} as IndexPattern;

describe('QueryBar', () => {
describe('QueryBarTopRowTopRow', () => {
const QUERY_INPUT_SELECTOR = 'InjectIntl(QueryBarInputUI)';
const TIMEPICKER_SELECTOR = 'EuiSuperDatePicker';
beforeEach(() => {
Expand All @@ -97,7 +97,7 @@ describe('QueryBar', () => {

it('Should render the given query', () => {
const component = shallowWithIntl(
<QueryBar.WrappedComponent
<QueryBarTopRow.WrappedComponent
uiSettings={startMock.uiSettings}
savedObjectsClient={startMock.savedObjects.client}
query={kqlQuery}
Expand All @@ -118,7 +118,7 @@ describe('QueryBar', () => {

it('Should create a unique PersistedLog based on the appName and query language', () => {
shallowWithIntl(
<QueryBar.WrappedComponent
<QueryBarTopRow.WrappedComponent
uiSettings={startMock.uiSettings}
savedObjectsClient={startMock.savedObjects.client}
query={kqlQuery}
Expand All @@ -139,7 +139,7 @@ describe('QueryBar', () => {

it('Should render only timepicker when no options provided', () => {
const component = shallowWithIntl(
<QueryBar.WrappedComponent
<QueryBarTopRow.WrappedComponent
uiSettings={startMock.uiSettings}
savedObjectsClient={startMock.savedObjects.client}
onSubmit={noop}
Expand All @@ -157,7 +157,7 @@ describe('QueryBar', () => {

it('Should not show timepicker when asked', () => {
const component = shallowWithIntl(
<QueryBar.WrappedComponent
<QueryBarTopRow.WrappedComponent
uiSettings={startMock.uiSettings}
savedObjectsClient={startMock.savedObjects.client}
onSubmit={noop}
Expand All @@ -176,7 +176,7 @@ describe('QueryBar', () => {

it('Should render timepicker with options', () => {
const component = shallowWithIntl(
<QueryBar.WrappedComponent
<QueryBarTopRow.WrappedComponent
uiSettings={startMock.uiSettings}
savedObjectsClient={startMock.savedObjects.client}
onSubmit={noop}
Expand All @@ -198,7 +198,7 @@ describe('QueryBar', () => {

it('Should render only query input bar', () => {
const component = shallowWithIntl(
<QueryBar.WrappedComponent
<QueryBarTopRow.WrappedComponent
uiSettings={startMock.uiSettings}
savedObjectsClient={startMock.savedObjects.client}
query={kqlQuery}
Expand All @@ -220,7 +220,7 @@ describe('QueryBar', () => {

it('Should NOT render query input bar if disabled', () => {
const component = shallowWithIntl(
<QueryBar.WrappedComponent
<QueryBarTopRow.WrappedComponent
uiSettings={startMock.uiSettings}
savedObjectsClient={startMock.savedObjects.client}
query={kqlQuery}
Expand All @@ -243,7 +243,7 @@ describe('QueryBar', () => {

it('Should NOT render query input bar if missing options', () => {
const component = shallowWithIntl(
<QueryBar.WrappedComponent
<QueryBarTopRow.WrappedComponent
uiSettings={startMock.uiSettings}
savedObjectsClient={startMock.savedObjects.client}
onSubmit={noop}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ interface State {
isDateRangeInvalid: boolean;
}

export class QueryBarUI extends Component<Props, State> {
export class QueryBarTopRowUI extends Component<Props, State> {
public static defaultProps = {
showQueryInput: true,
showDatePicker: true,
Expand Down Expand Up @@ -354,4 +354,4 @@ export class QueryBarUI extends Component<Props, State> {
}

// @ts-ignore
export const QueryBar = injectI18n(QueryBarUI);
export const QueryBarTopRow = injectI18n(QueryBarTopRowUI);
4 changes: 3 additions & 1 deletion src/legacy/core_plugins/data/public/query/query_bar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
* under the License.
*/

export { QueryBar, QueryBarInput } from './components';
export { QueryBarTopRow } from './components/query_bar_top_row';
export { QueryBarInput } from './components/query_bar_input';

export { fromUser } from './lib/from_user';
export { toUser } from './lib/to_user';
export { getQueryLog } from './lib/get_query_log';
Expand Down
2 changes: 1 addition & 1 deletion src/legacy/core_plugins/data/public/query/query_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ export class QueryService {
/** @public */
export type QuerySetup = ReturnType<QueryService['setup']>;

export { Query, QueryBar, QueryBarInput } from './query_bar';
export * from './query_bar';
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ const startMock = coreMock.createStart();
jest.mock('../../../../../data/public', () => {
return {
FilterBar: () => <div className="filterBar"></div>,
QueryBar: () => <div className="queryBar"></div>,
QueryBarInput: () => <div className="queryBar"></div>,
};
});

jest.mock('../../../query/query_bar', () => {
return {
QueryBarTopRow: () => <div className="queryBar"></div>,
};
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import { get, isEqual } from 'lodash';

import { toastNotifications } from 'ui/notify';
import { UiSettingsClientContract, SavedObjectsClientContract } from 'src/core/public';
import { IndexPattern, Query, QueryBar, FilterBar } from '../../../../../data/public';
import { IndexPattern, Query, FilterBar } from '../../../../../data/public';
import { QueryBarTopRow } from '../../../query';
import { SavedQuery, SavedQueryAttributes } from '../index';
import { SavedQueryMeta, SaveQueryForm } from './saved_query_management/save_query_form';
import { SavedQueryManagementComponent } from './saved_query_management/saved_query_management_component';
Expand Down Expand Up @@ -366,7 +367,7 @@ class SearchBarUI extends Component<SearchBarProps, State> {
let queryBar;
if (this.shouldRenderQueryBar()) {
queryBar = (
<QueryBar
<QueryBarTopRow
uiSettings={this.props.uiSettings}
savedObjectsClient={this.props.savedObjectsClient}
query={this.state.query}
Expand Down