[Maps] fix term join not updating when editing right field (#111030)
* [Maps] fix term join not updating when editing right field * tslint * clean up Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
b5f8d2e998
commit
b8faf091c9
|
@ -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;
|
||||
|
@ -50,9 +51,7 @@ type ESGeoLineSourceSyncMeta = {
|
|||
sortField: string;
|
||||
};
|
||||
|
||||
type ESTermSourceSyncMeta = {
|
||||
size: number;
|
||||
};
|
||||
export type ESTermSourceSyncMeta = Pick<ESTermSourceDescriptor, 'indexPatternId' | 'size' | 'term'>;
|
||||
|
||||
export type VectorSourceSyncMeta =
|
||||
| ESSearchSourceSyncMeta
|
||||
|
|
|
@ -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',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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';
|
||||
|
@ -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
|
||||
? {
|
||||
getSyncMeta(): ESTermSourceSyncMeta | null {
|
||||
return {
|
||||
indexPatternId: this._descriptor.indexPatternId,
|
||||
size: this._descriptor.size,
|
||||
}
|
||||
: null;
|
||||
term: this._descriptor.term,
|
||||
};
|
||||
}
|
||||
|
||||
getRightFields(): IField[] {
|
||||
|
|
Loading…
Reference in a new issue