Skip to content

Commit

Permalink
Move temporary types in data plugin to common/types. (#50280)
Browse files Browse the repository at this point in the history
* Move temporary ui imported types in data plugin to common/types.
Remove unnecessary mocks.

* Updated dashboard, discover and visualize mappings - type removal

* Revert "Updated dashboard, discover and visualize mappings - type removal"

This reverts commit 5e931ce.
  • Loading branch information
Liza Katz authored Nov 13, 2019
1 parent f317c25 commit 4c8afa7
Show file tree
Hide file tree
Showing 15 changed files with 13 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/plugins/data/common/es_query/filters/exists_filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { Filter, FilterMeta } from './meta_filter';
import { IndexPattern, Field } from './types';
import { IndexPattern, Field } from '../../types';

export type ExistsFilterMeta = FilterMeta;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { buildInlineScriptForPhraseFilter, buildPhraseFilter } from './phrase_filter';
import { IndexPattern } from './types';
import { IndexPattern } from '../../types';
import { getField } from '../__tests__/fields_mock';

describe('Phrase filter builder', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/common/es_query/filters/phrase_filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import { get, isPlainObject } from 'lodash';
import { Filter, FilterMeta } from './meta_filter';
import { IndexPattern, Field } from './types';
import { IndexPattern, Field } from '../../types';

export type PhraseFilterMeta = FilterMeta & {
params?: {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/common/es_query/filters/phrases_filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { Filter, FilterMeta } from './meta_filter';
import { Field, IndexPattern } from './types';
import { Field, IndexPattern } from '../../types';
import { getPhraseScript } from './phrase_filter';

export type PhrasesFilterMeta = FilterMeta & {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { buildQueryFilter } from './query_string_filter';
import { IndexPattern } from './types';
import { IndexPattern } from '../../types';

describe('Phrase filter builder', () => {
let indexPattern: IndexPattern;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { Filter, FilterMeta } from './meta_filter';
import { IndexPattern } from './types';
import { IndexPattern } from '../../types';

export type QueryStringFilterMeta = FilterMeta;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import { each } from 'lodash';
import { buildRangeFilter, RangeFilter } from './range_filter';
import { IndexPattern, Field } from './types';
import { IndexPattern, Field } from '../../types';
import { getField } from '../__tests__/fields_mock';

describe('Range filter builder', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/common/es_query/filters/range_filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
import { map, reduce, mapValues, get, keys, pick } from 'lodash';
import { Filter, FilterMeta } from './meta_filter';
import { Field, IndexPattern } from './types';
import { Field, IndexPattern } from '../../types';

const OPERANDS_IN_RANGE = 2;

Expand Down
6 changes: 0 additions & 6 deletions src/plugins/data/common/es_query/filters/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,3 @@ export enum FILTERS {
GEO_BOUNDING_BOX = 'geo_bounding_box',
GEO_POLYGON = 'geo_polygon',
}

// We can't import the real types from the data plugin, so need to either duplicate
// them here or figure out another solution, perhaps housing them in this package
// will be replaces after Fieds / IndexPattern will be moved into new platform
export type Field = any;
export type IndexPattern = any;
1 change: 1 addition & 0 deletions src/plugins/data/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ export * from './kbn_field_types/types';
// will be replaces after Fieds / IndexPattern will be moved into new platform
export type Field = any;
export type IndexPattern = any;
export type StaticIndexPattern = any;
2 changes: 1 addition & 1 deletion src/plugins/data/public/autocomplete_provider/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
* under the License.
*/

import { StaticIndexPattern, Field } from 'ui/index_patterns';
import { AutocompleteProviderRegister } from '.';
import { Field, StaticIndexPattern } from '..';

export type AutocompletePublicPluginSetup = Pick<
AutocompleteProviderRegister,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@ const createMockStorage = () => ({
clear: jest.fn(),
});

jest.mock('ui/chrome', () => {
return {
getBasePath: () => `/some/base/path`,
};
});

const historyName = 'testHistory';
const historyLimit = 10;
const payload = [
Expand Down
4 changes: 1 addition & 3 deletions src/plugins/data/public/suggestions_provider/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/

// Should be import { Field } from './index_patterns';
export type Field = any;
import { Field } from '..';

export type IGetSuggestions = (index: string, field: Field, query: string, boolFilter?: any) => any;
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

// TODO: remove when index patterns are moved here.
jest.mock('ui/new_platform');
jest.mock('ui/index_patterns');

import { stubIndexPattern, stubFields } from '../stubs';
import { getSuggestionsProvider } from './value_suggestions';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
import { memoize } from 'lodash';

import { UiSettingsClientContract, HttpServiceBase } from 'src/core/public';
import { IGetSuggestions, Field } from './types';
import { IGetSuggestions } from './types';
import { Field } from '..';

export function getSuggestionsProvider(
uiSettings: UiSettingsClientContract,
Expand Down

0 comments on commit 4c8afa7

Please sign in to comment.