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

Query String(Bar) Input - cleanup #51598

Merged
merged 10 commits into from
Nov 27, 2019
Merged
Show file tree
Hide file tree
Changes from 5 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/core/MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,7 @@ import { setup, start } from '../core_plugins/visualizations/public/legacy';
| ------------------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `import 'ui/apply_filters'` | `import { ApplyFiltersPopover } from '../data/public'` | Directive is deprecated. |
| `import 'ui/filter_bar'` | `import { FilterBar } from '../data/public'` | Directive is deprecated. |
| `import 'ui/query_bar'` | `import { QueryBarInput } from '../data/public'` | Directives are deprecated. |
| `import 'ui/query_bar'` | `import { QueryStringInput } from '../data/public'` | Directives are deprecated. |
| `import 'ui/search_bar'` | `import { SearchBar } from '../data/public'` | Directive is deprecated. |
| `import 'ui/kbn_top_nav'` | `import { TopNavMenu } from '../navigation/public'` | Directive is still available in `ui/kbn_top_nav`. |
| `ui/saved_objects/components/saved_object_finder` | `import { SavedObjectFinder } from '../kibana_react/public'` | |
Expand Down
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 @@ -38,7 +38,7 @@ export {
IndexPatterns,
StaticIndexPattern,
} from './index_patterns';
export { QueryBarInput } from './query';
export { QueryStringInput } from './query';
export { SearchBar, SearchBarProps, SavedQueryAttributes, SavedQuery } from './search';

/** @public static code */
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@import './query_bar';
@import './typeahead/index';
@import '/src/plugins/data/public/ui/typeahead/index';
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@
* under the License.
*/

import { mockPersistedLogFactory } from './query_bar_input.test.mocks';
import { mockPersistedLogFactory } from './query_string_input.test.mocks';

import React from 'react';
import { mount } from 'enzyme';
import { QueryBarTopRow } from './query_bar_top_row';
import { IndexPattern } from '../../../index';

/* eslint-disable @kbn/eslint/no-restricted-paths */

import { stubIndexPatternWithFields } from '../../../../../../../plugins/data/public/stubs';
/* eslint-enable @kbn/eslint/no-restricted-paths */

import { coreMock } from '../../../../../../../core/public/mocks';
import { KibanaContextProvider } from 'src/plugins/kibana_react/public';
Expand Down Expand Up @@ -85,21 +89,6 @@ const createMockStorage = () => ({
clear: jest.fn(),
});

const mockIndexPattern = {
id: '1234',
title: 'logstash-*',
fields: [
{
name: 'response',
type: 'number',
esTypes: ['integer'],
aggregatable: true,
filterable: true,
searchable: true,
},
],
} as IndexPattern;

function wrapQueryBarTopRowInContext(testProps: any) {
const defaultOptions = {
screenTitle: 'Another Screen',
Expand All @@ -124,7 +113,7 @@ function wrapQueryBarTopRowInContext(testProps: any) {
}

describe('QueryBarTopRowTopRow', () => {
const QUERY_INPUT_SELECTOR = 'QueryBarInputUI';
const QUERY_INPUT_SELECTOR = 'QueryStringInputUI';
const TIMEPICKER_SELECTOR = 'EuiSuperDatePicker';
const TIMEPICKER_DURATION = '[data-shared-timefilter-duration]';

Expand All @@ -138,7 +127,7 @@ describe('QueryBarTopRowTopRow', () => {
query: kqlQuery,
screenTitle: 'Another Screen',
isDirty: false,
indexPatterns: [mockIndexPattern],
indexPatterns: [stubIndexPatternWithFields],
timeHistory: mockTimeHistory,
})
);
Expand All @@ -152,7 +141,7 @@ describe('QueryBarTopRowTopRow', () => {
wrapQueryBarTopRowInContext({
query: kqlQuery,
screenTitle: 'Another Screen',
indexPatterns: [mockIndexPattern],
indexPatterns: [stubIndexPatternWithFields],
timeHistory: mockTimeHistory,
disableAutoFocus: true,
isDirty: false,
Expand Down Expand Up @@ -225,7 +214,7 @@ describe('QueryBarTopRowTopRow', () => {
const component = mount(
wrapQueryBarTopRowInContext({
query: kqlQuery,
indexPatterns: [mockIndexPattern],
indexPatterns: [stubIndexPatternWithFields],
isDirty: false,
screenTitle: 'Another Screen',
showDatePicker: false,
Expand All @@ -245,7 +234,7 @@ describe('QueryBarTopRowTopRow', () => {
query: kqlQuery,
isDirty: false,
screenTitle: 'Another Screen',
indexPatterns: [mockIndexPattern],
indexPatterns: [stubIndexPatternWithFields],
showQueryInput: false,
showDatePicker: false,
timeHistory: mockTimeHistory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { FormattedMessage, InjectedIntl, injectI18n } from '@kbn/i18n/react';
import { Toast } from 'src/core/public';
import {
IDataPluginServices,
IIndexPattern,
TimeRange,
TimeHistoryContract,
Query,
Expand All @@ -45,8 +46,7 @@ import {
} from '../../../../../../../plugins/data/public';
import { useKibana, toMountPoint } from '../../../../../../../plugins/kibana_react/public';

import { IndexPattern } from '../../../index_patterns';
import { QueryBarInput } from './query_bar_input';
import { QueryStringInput } from './query_string_input';

interface Props {
query?: Query;
Expand All @@ -56,7 +56,7 @@ interface Props {
dataTestSubj?: string;
disableAutoFocus?: boolean;
screenTitle?: string;
indexPatterns?: Array<IndexPattern | string>;
indexPatterns?: Array<IIndexPattern | string>;
intl: InjectedIntl;
isLoading?: boolean;
prepend?: React.ReactNode;
Expand Down Expand Up @@ -181,7 +181,7 @@ function QueryBarTopRowUI(props: Props) {
if (!shouldRenderQueryInput()) return;
return (
<EuiFlexItem>
<QueryBarInput
<QueryStringInput
disableAutoFocus={props.disableAutoFocus}
indexPatterns={props.indexPatterns!}
prepend={props.prepend}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,10 @@
* under the License.
*/

const mockIndexPattern = {
id: '1234',
title: 'logstash-*',
fields: [
{
name: 'response',
type: 'number',
esTypes: ['integer'],
aggregatable: true,
filterable: true,
searchable: true,
},
],
};
/* eslint-disable @kbn/eslint/no-restricted-paths */

import { stubIndexPatternWithFields } from '../../../../../../../plugins/data/public/stubs';
/* eslint-enable @kbn/eslint/no-restricted-paths */

export const mockPersistedLog = {
add: jest.fn(),
Expand All @@ -43,7 +33,7 @@ export const mockPersistedLogFactory = jest.fn<jest.Mocked<typeof mockPersistedL

export const mockFetchIndexPatterns = jest
.fn()
.mockReturnValue(Promise.resolve([mockIndexPattern]));
.mockReturnValue(Promise.resolve([stubIndexPatternWithFields]));

jest.mock('../../../../../../../plugins/data/public/query/persisted_log', () => ({
PersistedLog: mockPersistedLogFactory,
Expand Down
Loading