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

[Maps] Rename modules for clarity #41608

Merged
merged 4 commits into from
Jul 22, 2019
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
*/


import { ESJoinSource } from '../sources/es_join_source';
import { ESTermSource } from '../sources/es_term_source';
thomasneirynck marked this conversation as resolved.
Show resolved Hide resolved
import { VectorStyle } from '../styles/vector_style';

export class LeftInnerJoin {
export class InnerJoin {

constructor(joinDescriptor, inspectorAdapters) {
this._descriptor = joinDescriptor;
this._rightSource = new ESJoinSource(joinDescriptor.right, inspectorAdapters);
this._rightSource = new ESTermSource(joinDescriptor.right, inspectorAdapters);
}

destroy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { LeftInnerJoin } from './left_inner_join';
import { InnerJoin } from './inner_join';

jest.mock('ui/vis/editors/default/schemas', () => {
class MockSchemas {}
Expand All @@ -25,7 +25,7 @@ const rightSource = {
term: 'geo.dest',
};

const leftJoin = new LeftInnerJoin({
const leftJoin = new InnerJoin({
leftField: 'iso2',
right: rightSource
});
Expand Down Expand Up @@ -73,7 +73,7 @@ describe('joinPropertiesToFeature', () => {

it('Should coerce to string before joining', () => {

const leftJoin = new LeftInnerJoin({
const leftJoin = new InnerJoin({
leftField: 'zipcode',
right: rightSource
});
Expand Down Expand Up @@ -115,7 +115,7 @@ describe('joinPropertiesToFeature', () => {

it('Should handle falsy values', () => {

const leftJoin = new LeftInnerJoin({
const leftJoin = new InnerJoin({
leftField: 'code',
right: rightSource
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ export function extractPropertiesMap(rawEsData, propertyNames, countPropertyName
return propertiesMap;
}

export class ESJoinSource extends AbstractESSource {
export class ESTermSource extends AbstractESSource {

static type = 'ES_JOIN_SOURCE';
static type = 'ES_TERM_SOURCE';


static renderEditor({}) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { ESJoinSource, extractPropertiesMap } from './es_join_source';
import { ESTermSource, extractPropertiesMap } from './es_term_source';

jest.mock('../vector_layer', () => {});
jest.mock('ui/vis/editors/default/schemas', () => ({
Expand Down Expand Up @@ -37,7 +37,7 @@ const metricExamples = [
describe('getMetricFields', () => {

it('should add default "count" metric when no metrics are provided', () => {
const source = new ESJoinSource({
const source = new ESTermSource({
indexPatternTitle: indexPatternTitle,
term: termFieldName,
});
Expand All @@ -51,7 +51,7 @@ describe('getMetricFields', () => {
});

it('should remove incomplete metric configurations', () => {
const source = new ESJoinSource({
const source = new ESTermSource({
indexPatternTitle: indexPatternTitle,
term: termFieldName,
metrics: metricExamples,
Expand All @@ -76,7 +76,7 @@ describe('_makeAggConfigs', () => {
describe('no metrics', () => {
let aggConfigs;
beforeAll(() => {
const source = new ESJoinSource({
const source = new ESTermSource({
indexPatternTitle: indexPatternTitle,
term: termFieldName,
});
Expand Down Expand Up @@ -112,7 +112,7 @@ describe('_makeAggConfigs', () => {
describe('metrics', () => {
let aggConfigs;
beforeAll(() => {
const source = new ESJoinSource({
const source = new ESTermSource({
indexPatternTitle: indexPatternTitle,
term: 'myTermField',
metrics: metricExamples
Expand Down
10 changes: 5 additions & 5 deletions x-pack/legacy/plugins/maps/public/layers/vector_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import turf from 'turf';
import React from 'react';
import { AbstractLayer } from './layer';
import { VectorStyle } from './styles/vector_style';
import { LeftInnerJoin } from './joins/left_inner_join';
import { InnerJoin } from './joins/inner_join';
import {
GEO_JSON_TYPE,
FEATURE_ID_PROPERTY_NAME,
Expand Down Expand Up @@ -88,7 +88,7 @@ export class VectorLayer extends AbstractLayer {
this._joins = [];
if (options.layerDescriptor.joins) {
options.layerDescriptor.joins.forEach((joinDescriptor) => {
this._joins.push(new LeftInnerJoin(joinDescriptor, this._source.getInspectorAdapters()));
this._joins.push(new InnerJoin(joinDescriptor, this._source.getInspectorAdapters()));
});
}
}
Expand Down Expand Up @@ -430,9 +430,9 @@ export class VectorLayer extends AbstractLayer {
let isFeatureVisible = true;
for (let j = 0; j < joinStates.length; j++) {
const joinState = joinStates[j];
const leftInnerJoin = joinState.join;
const rightMetricFields = leftInnerJoin.getRightMetricFields();
const canJoinOnCurrent = leftInnerJoin.joinPropertiesToFeature(feature, joinState.propertiesMap, rightMetricFields);
const InnerJoin = joinState.join;
const rightMetricFields = InnerJoin.getRightMetricFields();
const canJoinOnCurrent = InnerJoin.joinPropertiesToFeature(feature, joinState.propertiesMap, rightMetricFields);
isFeatureVisible = isFeatureVisible && canJoinOnCurrent;
}

Expand Down
4 changes: 2 additions & 2 deletions x-pack/legacy/plugins/maps/public/layers/vector_layer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/

jest.mock('./joins/left_inner_join', () => ({
LeftInnerJoin: Object
jest.mock('./joins/inner_join', () => ({
InnerJoin: Object
}));

jest.mock('./tooltips/join_tooltip_property', () => ({
Expand Down