Skip to content
Closed
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
1 change: 1 addition & 0 deletions packages/kbn-utility-types/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type B = UnwrapPromise<A>; // string

## Reference

- `Assign<T, U>` &mdash; From `U` assign properties to `T` (just like object assign).
- `Ensure<T, X>` &mdash; Makes sure `T` is of type `X`.
- `ObservableLike<T>` &mdash; Minimal interface for an object resembling an `Observable`.
- `PublicContract<T>` &mdash; Returns an object with public keys only.
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-utility-types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { PromiseType } from 'utility-types';
export { $Values, Required, Optional, Class } from 'utility-types';
export { $Values, Assign, Class, Optional, Required } from 'utility-types';

/**
* A type that may or may not be a `Promise`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,14 @@

import moment from 'moment';

jest.mock('../../search/aggs', () => ({
AggConfigs: function AggConfigs() {
return {
createAggConfig: ({ params }: Record<string, any>) => ({
params,
getIndexPattern: () => ({
timeFieldName: 'time',
}),
}),
};
},
}));

jest.mock('../../../../../../plugins/data/public/services', () => ({
getIndexPatterns: () => {
return {
get: async () => {
return {
id: 'logstash-*',
timeFieldName: 'time',
};
},
};
},
}));

import { onBrushEvent, BrushEvent } from './brush_event';

import { mockDataServices } from '../../search/aggs/test_helpers';
import { IndexPatternsContract } from '../../../../../../plugins/data/public';
import { dataPluginMock } from '../../../../../../plugins/data/public/mocks';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { setIndexPatterns } from '../../../../../../plugins/data/public/services';

describe('brushEvent', () => {
const DAY_IN_MS = 24 * 60 * 60 * 1000;
const JAN_01_2014 = 1388559600000;
Expand All @@ -59,11 +39,28 @@ describe('brushEvent', () => {
},
getIndexPattern: () => ({
timeFieldName: 'time',
fields: {
getByName: () => undefined,
filter: () => [],
},
}),
},
];

beforeEach(() => {
mockDataServices();
setIndexPatterns(({
...dataPluginMock.createStartContract().indexPatterns,
get: async () => ({
id: 'indexPatternId',
timeFieldName: 'time',
fields: {
getByName: () => undefined,
filter: () => [],
},
}),
} as unknown) as IndexPatternsContract);

baseEvent = {
data: {
ordered: {
Expand Down
12 changes: 6 additions & 6 deletions src/legacy/core_plugins/data/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ export {
} from '../../../../plugins/data/public';
export {
// agg_types
AggParam,
AggParamOption,
DateRangeKey,
AggParam, // only the type is used externally, only in vis editor
AggParamOption, // only the type is used externally
DateRangeKey, // only used in field formatter deserialization, which will live in data
IAggConfig,
IAggConfigs,
IAggType,
IFieldParamType,
IMetricAggType,
IpRangeKey,
IpRangeKey, // only used in field formatter deserialization, which will live in data
ISchemas,
OptionedParamEditorProps,
OptionedValueProp,
OptionedParamEditorProps, // only type is used externally
OptionedValueProp, // only type is used externally
} from './search/types';

/** @public static code */
Expand Down
6 changes: 5 additions & 1 deletion src/legacy/core_plugins/data/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {
setOverlays,
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
} from '../../../../plugins/data/public/services';
import { setSearchServiceShim } from './services';
import { SELECT_RANGE_ACTION, selectRangeAction } from './actions/select_range_action';
import { VALUE_CLICK_ACTION, valueClickAction } from './actions/value_click_action';
import {
Expand Down Expand Up @@ -112,6 +113,9 @@ export class DataPlugin
}

public start(core: CoreStart, { data, uiActions }: DataPluginStartDependencies): DataStart {
const search = this.search.start(core);
setSearchServiceShim(search);

setUiSettings(core.uiSettings);
setQueryService(data.query);
setIndexPatterns(data.indexPatterns);
Expand All @@ -123,7 +127,7 @@ export class DataPlugin
uiActions.attachAction(VALUE_CLICK_TRIGGER, VALUE_CLICK_ACTION);

return {
search: this.search.start(core),
search,
};
}

Expand Down
Loading