Skip to content

Commit

Permalink
update imports
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasneirynck committed Aug 19, 2020
1 parent 2ccc182 commit 089d6ed
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { MapExtent } from '../common/descriptor_types';
import { MapExtent } from './descriptor_types';

export function scaleBounds(bounds: MapExtent, scaleFactor: number): MapExtent;

export function turfBboxToBounds(turfBbox: unknown): MapExtent;

export function clampToLatBounds(lat: number): number;

export function clampToLonBounds(lon: number): number;
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import {
LON_INDEX,
LAT_INDEX,
} from '../common/constants';
import { getEsSpatialRelationLabel } from '../common/i18n_getters';
import { FILTERS } from '../../../../src/plugins/data/common/es_query/filters/types';
import { getEsSpatialRelationLabel } from './i18n_getters';
import { FILTERS } from '../../../../src/plugins/data/common';
import turfCircle from '@turf/circle';

const SPATIAL_FILTER_TYPE = FILTERS.SPATIAL_FILTER;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/

jest.mock('ui/new_platform');

jest.mock('./kibana_services', () => {
return {
SPATIAL_FILTER_TYPE: 'spatial_filter',
};
});

import {
hitsToGeoJson,
geoPointToGeometry,
Expand All @@ -22,7 +14,7 @@ import {
makeESBbox,
scaleBounds,
} from './elasticsearch_geo_utils';
import { indexPatterns } from '../../../../src/plugins/data/public';
import _ from 'lodash';

const geoFieldName = 'location';

Expand Down Expand Up @@ -173,19 +165,14 @@ describe('hitsToGeoJson', () => {
});

describe('dot in geoFieldName', () => {
const indexPatternMock = {
fields: {
getByName: (name) => {
const fields = {
['my.location']: {
type: 'geo_point',
},
};
return fields[name];
},
},
// This essentially should test the implmentation of index-pattern.flattenHit, rather than anything in geo_utils.
// Leaving this here for reference.
const geoFieldName = 'my.location';
const indexPatternFlattenHit = (hit) => {
return {
[geoFieldName]: _.get(hit._source, geoFieldName),
};
};
const indexPatternFlattenHit = indexPatterns.flattenHitWrapper(indexPatternMock);

it('Should handle geoField being an object', () => {
const hits = [
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/maps/public/actions/data_request_actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { ILayer } from '../classes/layers/layer';
import { IVectorLayer } from '../classes/layers/vector_layer/vector_layer';
import { DataMeta, MapExtent, MapFilters } from '../../common/descriptor_types';
import { DataRequestAbortError } from '../classes/util/data_request';
import { scaleBounds, turfBboxToBounds } from '../elasticsearch_geo_utils';
import { scaleBounds, turfBboxToBounds } from '../../common/elasticsearch_geo_utils';

const FIT_TO_BOUNDS_SCALE_FACTOR = 0.1;

Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/maps/public/actions/map_actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import {
MapRefreshConfig,
} from '../../common/descriptor_types';
import { INITIAL_LOCATION } from '../../common/constants';
import { scaleBounds } from '../elasticsearch_geo_utils';
import { scaleBounds } from '../../common/elasticsearch_geo_utils';

export function setMapInitError(errorMessage: string) {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import _ from 'lodash';
import { RENDER_AS } from '../../../../common/constants';
import { getTileBoundingBox } from './geo_tile_utils';
import { extractPropertiesFromBucket } from '../../util/es_agg_utils';
import { clamp } from '../../../elasticsearch_geo_utils';
import { clamp } from '../../../../common/elasticsearch_geo_utils';

const GRID_BUCKET_KEYS_TO_IGNORE = ['key', 'gridCentroid'];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { getDataSourceLabel } from '../../../../common/i18n_getters';
import { AbstractESAggSource, DEFAULT_METRIC } from '../es_agg_source';
import { DataRequestAbortError } from '../../util/data_request';
import { registerSource } from '../source_registry';
import { makeESBbox } from '../../../elasticsearch_geo_utils';
import { makeESBbox } from '../../../../common/elasticsearch_geo_utils';

export const MAX_GEOTILE_LEVEL = 29;

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

import _ from 'lodash';
import { DECIMAL_DEGREES_PRECISION } from '../../../../common/constants';
import { clampToLatBounds } from '../../../elasticsearch_geo_utils';
import { clampToLatBounds } from '../../../../common/elasticsearch_geo_utils';

const ZOOM_TILE_KEY_INDEX = 0;
const X_TILE_KEY_INDEX = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { getDataSourceLabel } from '../../../../common/i18n_getters';
import { convertToLines } from './convert_to_lines';
import { AbstractESAggSource, DEFAULT_METRIC } from '../es_agg_source';
import { registerSource } from '../source_registry';
import { turfBboxToBounds } from '../../../elasticsearch_geo_utils';
import { turfBboxToBounds } from '../../../../common/elasticsearch_geo_utils';
import { DataRequestAbortError } from '../../util/data_request';

const MAX_GEOTILE_LEVEL = 29;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import React from 'react';

import { AbstractESSource } from '../es_source';
import { getSearchService } from '../../../kibana_services';
import { hitsToGeoJson } from '../../../elasticsearch_geo_utils';
import { hitsToGeoJson } from '../../../../common/elasticsearch_geo_utils';
import { UpdateSourceEditor } from './update_source_editor';
import {
SOURCE_TYPES,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
getTimeFilter,
getSearchService,
} from '../../../kibana_services';
import { createExtentFilter } from '../../../elasticsearch_geo_utils';
import { createExtentFilter } from '../../../../common/elasticsearch_geo_utils';
import _ from 'lodash';
import { i18n } from '@kbn/i18n';
import uuid from 'uuid/v4';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';

import { URL_MAX_LENGTH } from '../../../../../../../src/core/public';
import { createSpatialFilterWithGeometry } from '../../../elasticsearch_geo_utils';
import { createSpatialFilterWithGeometry } from '../../../../common/elasticsearch_geo_utils';
import { GEO_JSON_TYPE } from '../../../../common/constants';
import { GeometryFilterForm } from '../../../components/geometry_filter_form';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
createSpatialFilterWithGeometry,
getBoundingBoxGeometry,
roundCoordinates,
} from '../../../../elasticsearch_geo_utils';
} from '../../../../../common/elasticsearch_geo_utils';
import { DrawTooltip } from './draw_tooltip';

const DRAW_RECTANGLE = 'draw_rectangle';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import sprites1 from '@elastic/maki/dist/[email protected]';
import sprites2 from '@elastic/maki/dist/[email protected]';
import { DrawControl } from './draw_control';
import { TooltipControl } from './tooltip_control';
import { clampToLatBounds, clampToLonBounds } from '../../../elasticsearch_geo_utils';
import { clampToLatBounds, clampToLonBounds } from '../../../../common/elasticsearch_geo_utils';
import { getInitialView } from './get_initial_view';
import { getPreserveDrawingBuffer } from '../../../kibana_services';

Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/maps/public/selectors/map_selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
SPATIAL_FILTERS_LAYER_ID,
} from '../../common/constants';
// @ts-ignore
import { extractFeaturesFromFilters } from '../elasticsearch_geo_utils';
import { extractFeaturesFromFilters } from '../../common/elasticsearch_geo_utils';
import { MapStoreState } from '../reducers/store';
import {
DataRequestDescriptor,
Expand Down

0 comments on commit 089d6ed

Please sign in to comment.