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

[7.x] [Maps] fix term join not updating when editing right field (#111030) #111425

Merged
merged 1 commit into from
Sep 7, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { SortDirection } from 'src/plugins/data/common/search';
import { RENDER_AS, SCALING_TYPES } from '../constants';
import { MapExtent, MapQuery } from './map_descriptor';
import { Filter, TimeRange } from '../../../../../src/plugins/data/common';
import { ESTermSourceDescriptor } from './source_descriptor_types';

export type Timeslice = {
from: number;
Expand Down Expand Up @@ -50,9 +51,7 @@ type ESGeoLineSourceSyncMeta = {
sortField: string;
};

type ESTermSourceSyncMeta = {
size: number;
};
export type ESTermSourceSyncMeta = Pick<ESTermSourceDescriptor, 'indexPatternId' | 'size' | 'term'>;

export type VectorSourceSyncMeta =
| ESSearchSourceSyncMeta
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,20 @@ describe('extractPropertiesMap', () => {
expect(properties[minPropName]).toBe(0);
});
});

describe('getSyncMeta', () => {
it('should contain meta requiring source re-fetch when changed', () => {
const source = new ESTermSource({
id: '1234',
indexPatternTitle: indexPatternTitle,
term: termFieldName,
indexPatternId: 'foobar',
size: 10,
});
expect(source.getSyncMeta()).toEqual({
indexPatternId: 'foobar',
size: 10,
term: 'myTermField',
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import {
} from '../../../../common/elasticsearch_util';
import {
ESTermSourceDescriptor,
ESTermSourceSyncMeta,
VectorJoinSourceRequestMeta,
VectorSourceSyncMeta,
} from '../../../../common/descriptor_types';
import { Adapters } from '../../../../../../../src/plugins/inspector/common/adapters';
import { PropertiesMap } from '../../../../common/elasticsearch_util';
Expand Down Expand Up @@ -171,12 +171,12 @@ export class ESTermSource extends AbstractESAggSource implements ITermJoinSource
return this.getMetricFields().map((esAggMetricField) => esAggMetricField.getName());
}

getSyncMeta(): VectorSourceSyncMeta | null {
return this._descriptor.size !== undefined
? {
size: this._descriptor.size,
}
: null;
getSyncMeta(): ESTermSourceSyncMeta | null {
return {
indexPatternId: this._descriptor.indexPatternId,
size: this._descriptor.size,
term: this._descriptor.term,
};
}

getRightFields(): IField[] {
Expand Down