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

[lens] More cleanup from QueryBar changes in master #45687

Merged
merged 1 commit into from
Sep 16, 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
18 changes: 9 additions & 9 deletions x-pack/legacy/plugins/lens/public/app_plugin/app.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import { toastNotifications } from 'ui/notify';
import { Storage } from 'ui/storage';
import { Document, SavedObjectStore } from '../persistence';
import { mount } from 'enzyme';
import { QueryBar } from '../../../../../../src/legacy/core_plugins/data/public/query';
import { QueryBarTopRow } from '../../../../../../src/legacy/core_plugins/data/public/query/query_bar';
import { SavedObjectsClientContract } from 'src/core/public';

jest.mock('../../../../../../src/legacy/core_plugins/data/public/query', () => ({
QueryBar: jest.fn(() => null),
jest.mock('../../../../../../src/legacy/core_plugins/data/public/query/query_bar', () => ({
QueryBarTopRow: jest.fn(() => null),
}));

jest.mock('ui/new_platform');
Expand Down Expand Up @@ -69,7 +69,7 @@ function makeDefaultArgs(): jest.Mocked<{
load: jest.fn(),
save: jest.fn(),
},
QueryBar: jest.fn(() => <div />),
QueryBarTopRow: jest.fn(() => <div />),
redirectTo: jest.fn(id => {}),
savedObjectsClient: jest.fn(),
} as unknown) as jest.Mocked<{
Expand Down Expand Up @@ -186,7 +186,7 @@ describe('Lens App', () => {
await waitForPromises();

expect(args.docStorage.load).toHaveBeenCalledWith('1234');
expect(QueryBar).toHaveBeenCalledWith(
expect(QueryBarTopRow).toHaveBeenCalledWith(
expect.objectContaining({
dateRangeFrom: 'now-7d',
dateRangeTo: 'now',
Expand Down Expand Up @@ -355,7 +355,7 @@ describe('Lens App', () => {

mount(<App {...args} />);

expect(QueryBar).toHaveBeenCalledWith(
expect(QueryBarTopRow).toHaveBeenCalledWith(
expect.objectContaining({
dateRangeFrom: 'now-7d',
dateRangeTo: 'now',
Expand All @@ -378,7 +378,7 @@ describe('Lens App', () => {

const instance = mount(<App {...args} />);

expect(QueryBar).toHaveBeenCalledWith(
expect(QueryBarTopRow).toHaveBeenCalledWith(
expect.objectContaining({
indexPatterns: [],
}),
Expand All @@ -393,7 +393,7 @@ describe('Lens App', () => {

instance.update();

expect(QueryBar).toHaveBeenCalledWith(
expect(QueryBarTopRow).toHaveBeenCalledWith(
expect.objectContaining({
indexPatterns: ['newIndex'],
}),
Expand All @@ -417,7 +417,7 @@ describe('Lens App', () => {

instance.update();

expect(QueryBar).toHaveBeenCalledWith(
expect(QueryBarTopRow).toHaveBeenCalledWith(
expect.objectContaining({
dateRangeFrom: 'now-14d',
dateRangeTo: 'now-7d',
Expand Down
5 changes: 3 additions & 2 deletions x-pack/legacy/plugins/lens/public/app_plugin/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import { Storage } from 'ui/storage';
import { toastNotifications } from 'ui/notify';
import { Chrome } from 'ui/chrome';
import { SavedObjectsClientContract } from 'src/core/public';
import { Query, QueryBar } from '../../../../../../src/legacy/core_plugins/data/public/query';
import { Query } from '../../../../../../src/legacy/core_plugins/data/public/query';
import { QueryBarTopRow } from '../../../../../../src/legacy/core_plugins/data/public/query/query_bar';
import { Document, SavedObjectStore } from '../persistence';
import { EditorFrameInstance } from '../types';
import { NativeRenderer } from '../native_renderer';
Expand Down Expand Up @@ -199,7 +200,7 @@ export function App({
</EuiFlexItem>
</EuiFlexGroup>
</nav>
<QueryBar
<QueryBarTopRow
data-test-subj="lnsApp_queryBar"
screenTitle={'lens'}
onSubmit={payload => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/

import { i18n } from '@kbn/i18n';
import { ExpressionFunction } from 'src/legacy/core_plugins/interpreter/types';
import { KibanaDatatable } from '../../../../../../src/legacy/core_plugins/interpreter/public';
import { ExpressionFunction } from '../../../../../../src/legacy/core_plugins/interpreter/types';
import { KibanaDatatable } from '../../../../../../src/legacy/core_plugins/interpreter/common';
import { LensMultiTable } from '../types';

interface MergeTables {
Expand Down
15 changes: 4 additions & 11 deletions x-pack/legacy/plugins/lens/public/editor_frame_plugin/mocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@

import React from 'react';
import { ExpressionRendererProps } from 'src/legacy/core_plugins/expressions/public';
import { setup as dataSetup } from '../../../../../../src/legacy/core_plugins/data/public/legacy';
import {
ExpressionsSetup,
ExpressionsStart,
} from '../../../../../../src/legacy/core_plugins/expressions/public';
import { DatasourcePublicAPI, FramePublicAPI, Visualization, Datasource } from '../types';
import { EditorFrameSetupPlugins, EditorFrameStartPlugins } from './plugin';

type DataSetup = typeof dataSetup;

export function createMockVisualization(): jest.Mocked<Visualization> {
return {
id: 'TEST_VIS',
Expand Down Expand Up @@ -84,16 +81,12 @@ export function createMockFramePublicAPI(): FrameMock {

type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;

export type MockedSetupDependencies = Omit<EditorFrameSetupPlugins, 'data'> & {
data: Omit<DataSetup, 'expressions'> & {
expressions: jest.Mocked<ExpressionsSetup>;
};
export type MockedSetupDependencies = Omit<EditorFrameSetupPlugins, 'expressions'> & {
expressions: jest.Mocked<ExpressionsSetup>;
};

export type MockedStartDependencies = Omit<EditorFrameStartPlugins, 'data'> & {
data: Omit<DataSetup, 'expressions'> & {
expressions: jest.Mocked<ExpressionsStart>;
};
export type MockedStartDependencies = Omit<EditorFrameStartPlugins, 'expressions'> & {
expressions: jest.Mocked<ExpressionsStart>;
};

export function createExpressionRendererMock(): jest.Mock<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { calculateFilterRatio } from './filter_ratio';
import { KibanaDatatable } from 'src/legacy/core_plugins/interpreter/public';
import { KibanaDatatable } from 'src/legacy/core_plugins/interpreter/common';

describe('calculate_filter_ratio', () => {
it('should collapse two rows and columns into a single row and column', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { renameColumns } from './rename_columns';
import { KibanaDatatable } from 'src/legacy/core_plugins/interpreter/public';
import { KibanaDatatable } from 'src/legacy/core_plugins/interpreter/common';

describe('rename_columns', () => {
it('should rename columns of a given datatable', () => {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/lens/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { Ast } from '@kbn/interpreter/common';
import { EuiIconType } from '@elastic/eui/src/components/icon/icon';
import { Query } from 'src/plugins/data/common';
import { KibanaDatatable } from '../../../../../src/legacy/core_plugins/interpreter/public';
import { KibanaDatatable } from '../../../../../src/legacy/core_plugins/interpreter/common';
import { DragContextState } from './drag_drop';
import { Document } from './persistence';

Expand Down