mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[Maps] show data view name in UI (#138928)
* [Maps] show data view name in UI * remove indexPatternTitle from join descriptor * clean up * i18n clean-up * fix jest test * jest test fix
This commit is contained in:
parent
99695135d9
commit
f46a6309bd
35 changed files with 46 additions and 149 deletions
|
@ -78,10 +78,10 @@ export default class IndexPatternSelect extends Component<IndexPatternSelectInte
|
|||
return;
|
||||
}
|
||||
|
||||
let indexPatternTitle;
|
||||
let label;
|
||||
try {
|
||||
const indexPattern = await this.props.indexPatternService.get(indexPatternId);
|
||||
indexPatternTitle = indexPattern.title;
|
||||
label = indexPattern.getName();
|
||||
} catch (err) {
|
||||
// index pattern no longer exists
|
||||
return;
|
||||
|
@ -94,23 +94,24 @@ export default class IndexPatternSelect extends Component<IndexPatternSelectInte
|
|||
this.setState({
|
||||
selectedIndexPattern: {
|
||||
value: indexPatternId,
|
||||
label: indexPatternTitle,
|
||||
label,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
debouncedFetch = _.debounce(async (searchValue: string) => {
|
||||
const idsAndTitles = await this.props.indexPatternService.getIdsWithTitle();
|
||||
const dataViews = await this.props.indexPatternService.getIdsWithTitle();
|
||||
if (!this.isMounted || searchValue !== this.state.searchValue) {
|
||||
return;
|
||||
}
|
||||
|
||||
const options = [];
|
||||
for (let i = 0; i < idsAndTitles.length; i++) {
|
||||
if (idsAndTitles[i].title.toLowerCase().includes(searchValue.toLowerCase())) {
|
||||
for (let i = 0; i < dataViews.length; i++) {
|
||||
const label = dataViews[i].name ? dataViews[i].name : dataViews[i].title;
|
||||
if (label && label.toLowerCase().includes(searchValue.toLowerCase())) {
|
||||
options.push({
|
||||
label: idsAndTitles[i].title,
|
||||
value: idsAndTitles[i].id,
|
||||
label,
|
||||
value: dataViews[i].id,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,7 +107,6 @@ export type ESPewPewSourceDescriptor = AbstractESAggSourceDescriptor & {
|
|||
};
|
||||
|
||||
export type ESTermSourceDescriptor = AbstractESAggSourceDescriptor & {
|
||||
indexPatternTitle?: string;
|
||||
term: string; // term field name
|
||||
whereQuery?: Query;
|
||||
size?: number;
|
||||
|
|
|
@ -18,8 +18,8 @@ export function getField(indexPattern: DataView, fieldName: string): DataViewFie
|
|||
if (!field) {
|
||||
throw new Error(
|
||||
i18n.translate('xpack.maps.source.esSearch.fieldNotFoundMsg', {
|
||||
defaultMessage: `Unable to find '{fieldName}' in index-pattern '{indexPatternTitle}'.`,
|
||||
values: { fieldName, indexPatternTitle: indexPattern.title },
|
||||
defaultMessage: `Unable to find '{fieldName}' in index-pattern '{indexPatternName}'.`,
|
||||
values: { fieldName, indexPatternName: indexPattern.getName() },
|
||||
})
|
||||
);
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ export class AggField extends CountAggField {
|
|||
async getLabel(): Promise<string> {
|
||||
return this._label
|
||||
? this._label
|
||||
: this._source.getAggLabel(
|
||||
: await this._source.getAggLabel(
|
||||
this._aggType,
|
||||
this._esDocField ? await this._esDocField.getLabel() : ''
|
||||
);
|
||||
|
|
|
@ -66,7 +66,7 @@ export class CountAggField implements IESAggField {
|
|||
}
|
||||
|
||||
async getLabel(): Promise<string> {
|
||||
return this._label ? this._label : this._source.getAggLabel(AGG_TYPE.COUNT, '');
|
||||
return this._label ? this._label : await this._source.getAggLabel(AGG_TYPE.COUNT, '');
|
||||
}
|
||||
|
||||
isValid(): boolean {
|
||||
|
|
|
@ -32,7 +32,7 @@ const mockEsAggSource = {
|
|||
getAggKey: (aggType: AGG_TYPE, fieldName: string) => {
|
||||
return 'agg_key';
|
||||
},
|
||||
getAggLabel: (aggType: AGG_TYPE, fieldName: string) => {
|
||||
getAggLabel: async (aggType: AGG_TYPE, fieldName: string) => {
|
||||
return 'agg_label';
|
||||
},
|
||||
getIndexPattern: async () => {
|
||||
|
|
|
@ -57,7 +57,7 @@ export class PercentileAggField extends AggField implements IESAggField {
|
|||
}
|
||||
|
||||
const suffix = getOrdinalSuffix(this._percentile);
|
||||
return `${this._percentile}${suffix} ${this._source.getAggLabel(
|
||||
return `${this._percentile}${suffix} ${await this._source.getAggLabel(
|
||||
this._getAggType(),
|
||||
this.getRootName()
|
||||
)}`;
|
||||
|
|
|
@ -15,7 +15,6 @@ const rightSource = {
|
|||
type: SOURCE_TYPES.ES_TERM_SOURCE,
|
||||
id: 'd3625663-5b34-4d50-a784-0d743f676a0c',
|
||||
indexPatternId: '90943e30-9a47-11e8-b64d-95841ca0b247',
|
||||
indexPatternTitle: 'kibana_sample_data_logs',
|
||||
term: 'geo.dest',
|
||||
metrics: [{ type: 'count' }],
|
||||
};
|
||||
|
|
|
@ -37,7 +37,6 @@ export interface CreateRegionMapLayerDescriptorParams {
|
|||
termsSize?: number;
|
||||
colorSchema: string;
|
||||
indexPatternId?: string;
|
||||
indexPatternTitle?: string;
|
||||
metricAgg: string;
|
||||
metricFieldName?: string;
|
||||
}
|
||||
|
@ -65,7 +64,6 @@ export function createRegionMapLayerDescriptor({
|
|||
termsSize,
|
||||
colorSchema,
|
||||
indexPatternId,
|
||||
indexPatternTitle,
|
||||
metricAgg,
|
||||
metricFieldName,
|
||||
}: CreateRegionMapLayerDescriptorParams): LayerDescriptor | null {
|
||||
|
@ -87,7 +85,6 @@ export function createRegionMapLayerDescriptor({
|
|||
type: SOURCE_TYPES.ES_TERM_SOURCE,
|
||||
id: joinId,
|
||||
indexPatternId,
|
||||
indexPatternTitle: indexPatternTitle ? indexPatternTitle : indexPatternId,
|
||||
term: termsFieldName,
|
||||
metrics: [metricsDescriptor],
|
||||
applyGlobalQuery: true,
|
||||
|
|
|
@ -72,7 +72,6 @@ describe('cloneDescriptor', () => {
|
|||
right: {
|
||||
id: '557d0f15',
|
||||
indexPatternId: 'myIndexPattern',
|
||||
indexPatternTitle: 'logs-*',
|
||||
metrics: [{ type: AGG_TYPE.COUNT }],
|
||||
term: 'myTermField',
|
||||
type: SOURCE_TYPES.ES_TERM_SOURCE,
|
||||
|
@ -114,7 +113,6 @@ describe('cloneDescriptor', () => {
|
|||
right: {
|
||||
id: '557d0f15',
|
||||
indexPatternId: 'myIndexPattern',
|
||||
indexPatternTitle: 'logs-*',
|
||||
term: 'myTermField',
|
||||
type: 'joinSource',
|
||||
} as unknown as ESTermSourceDescriptor,
|
||||
|
|
|
@ -38,14 +38,12 @@ function createChoroplethLayerDescriptor({
|
|||
sourceDescriptor,
|
||||
leftField,
|
||||
rightIndexPatternId,
|
||||
rightIndexPatternTitle,
|
||||
rightTermField,
|
||||
layerType,
|
||||
}: {
|
||||
sourceDescriptor: EMSFileSourceDescriptor | ESSearchSourceDescriptor;
|
||||
leftField: string;
|
||||
rightIndexPatternId: string;
|
||||
rightIndexPatternTitle: string;
|
||||
rightTermField: string;
|
||||
layerType: LAYER_TYPE.GEOJSON_VECTOR | LAYER_TYPE.MVT_VECTOR;
|
||||
}) {
|
||||
|
@ -98,7 +96,6 @@ function createChoroplethLayerDescriptor({
|
|||
type: SOURCE_TYPES.ES_TERM_SOURCE,
|
||||
id: joinId,
|
||||
indexPatternId: rightIndexPatternId,
|
||||
indexPatternTitle: rightIndexPatternTitle,
|
||||
term: rightTermField,
|
||||
metrics: [metricsDescriptor],
|
||||
applyGlobalQuery: true,
|
||||
|
@ -125,13 +122,11 @@ export function createEmsChoroplethLayerDescriptor({
|
|||
leftEmsFileId,
|
||||
leftEmsField,
|
||||
rightIndexPatternId,
|
||||
rightIndexPatternTitle,
|
||||
rightTermField,
|
||||
}: {
|
||||
leftEmsFileId: string;
|
||||
leftEmsField: string;
|
||||
rightIndexPatternId: string;
|
||||
rightIndexPatternTitle: string;
|
||||
rightTermField: string;
|
||||
}) {
|
||||
return createChoroplethLayerDescriptor({
|
||||
|
@ -141,7 +136,6 @@ export function createEmsChoroplethLayerDescriptor({
|
|||
}),
|
||||
leftField: leftEmsField,
|
||||
rightIndexPatternId,
|
||||
rightIndexPatternTitle,
|
||||
rightTermField,
|
||||
layerType: LAYER_TYPE.GEOJSON_VECTOR,
|
||||
});
|
||||
|
@ -152,14 +146,12 @@ export function createEsChoroplethLayerDescriptor({
|
|||
leftGeoField,
|
||||
leftJoinField,
|
||||
rightIndexPatternId,
|
||||
rightIndexPatternTitle,
|
||||
rightTermField,
|
||||
}: {
|
||||
leftIndexPatternId: string;
|
||||
leftGeoField: string;
|
||||
leftJoinField: string;
|
||||
rightIndexPatternId: string;
|
||||
rightIndexPatternTitle: string;
|
||||
rightTermField: string;
|
||||
}) {
|
||||
return createChoroplethLayerDescriptor({
|
||||
|
@ -174,7 +166,6 @@ export function createEsChoroplethLayerDescriptor({
|
|||
}),
|
||||
leftField: leftJoinField,
|
||||
rightIndexPatternId,
|
||||
rightIndexPatternTitle,
|
||||
rightTermField,
|
||||
layerType: LAYER_TYPE.MVT_VECTOR,
|
||||
});
|
||||
|
|
|
@ -66,7 +66,6 @@ interface State {
|
|||
leftEmsJoinField: string | null;
|
||||
leftElasticsearchJoinField: string | null;
|
||||
rightIndexPatternId: string;
|
||||
rightIndexPatternTitle: string | null;
|
||||
rightTermsFields: DataViewField[];
|
||||
rightJoinField: string | null;
|
||||
}
|
||||
|
@ -85,7 +84,6 @@ export class LayerTemplate extends Component<RenderWizardArguments, State> {
|
|||
leftEmsJoinField: null,
|
||||
leftElasticsearchJoinField: null,
|
||||
rightIndexPatternId: '',
|
||||
rightIndexPatternTitle: null,
|
||||
rightTermsFields: [],
|
||||
rightJoinField: null,
|
||||
};
|
||||
|
@ -99,7 +97,7 @@ export class LayerTemplate extends Component<RenderWizardArguments, State> {
|
|||
}
|
||||
|
||||
_loadRightFields = async (indexPatternId: string) => {
|
||||
this.setState({ rightTermsFields: [], rightIndexPatternTitle: null });
|
||||
this.setState({ rightTermsFields: [] });
|
||||
|
||||
let indexPattern;
|
||||
try {
|
||||
|
@ -116,7 +114,6 @@ export class LayerTemplate extends Component<RenderWizardArguments, State> {
|
|||
|
||||
this.setState({
|
||||
rightTermsFields: getTermsFields(indexPattern.fields),
|
||||
rightIndexPatternTitle: indexPattern.title,
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -265,14 +262,12 @@ export class LayerTemplate extends Component<RenderWizardArguments, State> {
|
|||
leftGeoField: this.state.leftGeoField!,
|
||||
leftJoinField: this.state.leftElasticsearchJoinField!,
|
||||
rightIndexPatternId: this.state.rightIndexPatternId,
|
||||
rightIndexPatternTitle: this.state.rightIndexPatternTitle!,
|
||||
rightTermField: this.state.rightJoinField!,
|
||||
})
|
||||
: createEmsChoroplethLayerDescriptor({
|
||||
leftEmsFileId: this.state.leftEmsFileId!,
|
||||
leftEmsField: this.state.leftEmsJoinField!,
|
||||
rightIndexPatternId: this.state.rightIndexPatternId,
|
||||
rightIndexPatternTitle: this.state.rightIndexPatternTitle!,
|
||||
rightTermField: this.state.rightJoinField!,
|
||||
});
|
||||
|
||||
|
|
|
@ -55,7 +55,6 @@ describe('createLayerDescriptor', () => {
|
|||
applyGlobalTime: true,
|
||||
id: '12345',
|
||||
indexPatternId: 'apm_static_index_pattern_id',
|
||||
indexPatternTitle: 'traces-apm*,logs-apm*,metrics-apm*,apm-*',
|
||||
metrics: [
|
||||
{
|
||||
field: 'transaction.duration.us',
|
||||
|
|
|
@ -173,7 +173,6 @@ export function createLayerDescriptor({
|
|||
type: SOURCE_TYPES.ES_TERM_SOURCE,
|
||||
id: joinId,
|
||||
indexPatternId: APM_INDEX_PATTERN_ID,
|
||||
indexPatternTitle: APM_INDEX_PATTERN_TITLE, // TODO look up from APM_OSS.indexPattern
|
||||
term: 'client.geo.country_iso_code',
|
||||
metrics: [metricsDescriptor],
|
||||
whereQuery: apmSourceQuery,
|
||||
|
|
|
@ -21,7 +21,7 @@ export const DEFAULT_METRIC = { type: AGG_TYPE.COUNT };
|
|||
|
||||
export interface IESAggSource extends IESSource {
|
||||
getAggKey(aggType: AGG_TYPE, fieldName: string): string;
|
||||
getAggLabel(aggType: AGG_TYPE, fieldLabel: string): string;
|
||||
getAggLabel(aggType: AGG_TYPE, fieldLabel: string): Promise<string>;
|
||||
getMetricFields(): IESAggField[];
|
||||
getMetricFieldForName(fieldName: string): IESAggField | null;
|
||||
getValueAggsDsl(indexPattern: DataView): { [key: string]: unknown };
|
||||
|
@ -88,7 +88,7 @@ export abstract class AbstractESAggSource extends AbstractESSource implements IE
|
|||
});
|
||||
}
|
||||
|
||||
getAggLabel(aggType: AGG_TYPE, fieldLabel: string): string {
|
||||
async getAggLabel(aggType: AGG_TYPE, fieldLabel: string): Promise<string> {
|
||||
switch (aggType) {
|
||||
case AGG_TYPE.COUNT:
|
||||
return COUNT_PROP_LABEL;
|
||||
|
|
|
@ -142,14 +142,6 @@ export class ESGeoGridSource extends AbstractESAggSource implements IMvtVectorSo
|
|||
}
|
||||
|
||||
async getImmutableProperties(): Promise<ImmutableSourceProperty[]> {
|
||||
let indexPatternName = this.getIndexPatternId();
|
||||
try {
|
||||
const indexPattern = await this.getIndexPattern();
|
||||
indexPatternName = indexPattern.title;
|
||||
} catch (error) {
|
||||
// ignore error, title will just default to id
|
||||
}
|
||||
|
||||
return [
|
||||
{
|
||||
label: getDataSourceLabel(),
|
||||
|
@ -157,7 +149,7 @@ export class ESGeoGridSource extends AbstractESAggSource implements IMvtVectorSo
|
|||
},
|
||||
{
|
||||
label: getDataViewLabel(),
|
||||
value: indexPatternName,
|
||||
value: await this.getDisplayName(),
|
||||
},
|
||||
{
|
||||
label: i18n.translate('xpack.maps.source.esGrid.geospatialFieldLabel', {
|
||||
|
|
|
@ -109,14 +109,6 @@ export class ESGeoLineSource extends AbstractESAggSource {
|
|||
}
|
||||
|
||||
async getImmutableProperties(): Promise<ImmutableSourceProperty[]> {
|
||||
let indexPatternTitle = this.getIndexPatternId();
|
||||
try {
|
||||
const indexPattern = await this.getIndexPattern();
|
||||
indexPatternTitle = indexPattern.title;
|
||||
} catch (error) {
|
||||
// ignore error, title will just default to id
|
||||
}
|
||||
|
||||
return [
|
||||
{
|
||||
label: getDataSourceLabel(),
|
||||
|
@ -124,7 +116,7 @@ export class ESGeoLineSource extends AbstractESAggSource {
|
|||
},
|
||||
{
|
||||
label: getDataViewLabel(),
|
||||
value: indexPatternTitle,
|
||||
value: await this.getDisplayName(),
|
||||
},
|
||||
{
|
||||
label: i18n.translate('xpack.maps.source.esGeoLine.geospatialFieldLabel', {
|
||||
|
|
|
@ -96,14 +96,6 @@ export class ESPewPewSource extends AbstractESAggSource {
|
|||
}
|
||||
|
||||
async getImmutableProperties() {
|
||||
let indexPatternTitle = this.getIndexPatternId();
|
||||
try {
|
||||
const indexPattern = await this.getIndexPattern();
|
||||
indexPatternTitle = indexPattern.title;
|
||||
} catch (error) {
|
||||
// ignore error, title will just default to id
|
||||
}
|
||||
|
||||
return [
|
||||
{
|
||||
label: getDataSourceLabel(),
|
||||
|
@ -111,7 +103,7 @@ export class ESPewPewSource extends AbstractESAggSource {
|
|||
},
|
||||
{
|
||||
label: getDataViewLabel(),
|
||||
value: indexPatternTitle,
|
||||
value: await this.getDisplayName(),
|
||||
},
|
||||
{
|
||||
label: i18n.translate('xpack.maps.source.pewPew.sourceGeoFieldLabel', {
|
||||
|
|
|
@ -220,15 +220,12 @@ export class ESSearchSource extends AbstractESSource implements IMvtVectorSource
|
|||
}
|
||||
|
||||
async getImmutableProperties(): Promise<ImmutableSourceProperty[]> {
|
||||
let indexPatternName = this.getIndexPatternId();
|
||||
let geoFieldType = '';
|
||||
try {
|
||||
const indexPattern = await this.getIndexPattern();
|
||||
indexPatternName = indexPattern.title;
|
||||
const geoField = await this._getGeoField();
|
||||
geoFieldType = geoField.type;
|
||||
} catch (error) {
|
||||
// ignore error, title will just default to id
|
||||
// ignore error, geoFieldType will just be blank
|
||||
}
|
||||
|
||||
return [
|
||||
|
@ -238,7 +235,7 @@ export class ESSearchSource extends AbstractESSource implements IMvtVectorSource
|
|||
},
|
||||
{
|
||||
label: getDataViewLabel(),
|
||||
value: indexPatternName,
|
||||
value: await this.getDisplayName(),
|
||||
},
|
||||
{
|
||||
label: i18n.translate('xpack.maps.source.esSearch.geoFieldLabel', {
|
||||
|
|
|
@ -404,8 +404,8 @@ export class AbstractESSource extends AbstractVectorSource implements IESSource
|
|||
if (!geoField) {
|
||||
throw new Error(
|
||||
i18n.translate('xpack.maps.source.esSource.noGeoFieldErrorMessage', {
|
||||
defaultMessage: `Data view {indexPatternTitle} no longer contains the geo field {geoField}`,
|
||||
values: { indexPatternTitle: indexPattern.title, geoField: this.getGeoFieldName() },
|
||||
defaultMessage: `Data view "{indexPatternLabel}"" no longer contains the geo field "{geoField}"`,
|
||||
values: { indexPatternLabel: indexPattern.getName(), geoField: this.getGeoFieldName() },
|
||||
})
|
||||
);
|
||||
}
|
||||
|
@ -415,7 +415,7 @@ export class AbstractESSource extends AbstractVectorSource implements IESSource
|
|||
async getDisplayName(): Promise<string> {
|
||||
try {
|
||||
const indexPattern = await this.getIndexPattern();
|
||||
return indexPattern.title;
|
||||
return indexPattern.getName();
|
||||
} catch (error) {
|
||||
// Unable to load index pattern, just return id as display name
|
||||
return this.getIndexPatternId();
|
||||
|
|
|
@ -9,7 +9,6 @@ import { ESTermSource, extractPropertiesMap } from './es_term_source';
|
|||
|
||||
jest.mock('../../layers/vector_layer', () => {});
|
||||
|
||||
const indexPatternTitle = 'myIndex';
|
||||
const termFieldName = 'myTermField';
|
||||
const sumFieldName = 'myFieldGettingSummed';
|
||||
const metricExamples = [
|
||||
|
@ -33,19 +32,17 @@ describe('getMetricFields', () => {
|
|||
it('should override name and label of count metric', async () => {
|
||||
const source = new ESTermSource({
|
||||
id: '1234',
|
||||
indexPatternTitle: indexPatternTitle,
|
||||
term: termFieldName,
|
||||
indexPatternId: 'foobar',
|
||||
});
|
||||
const metrics = source.getMetricFields();
|
||||
expect(metrics[0].getName()).toEqual('__kbnjoin__count__1234');
|
||||
expect(await metrics[0].getLabel()).toEqual('Count of myIndex');
|
||||
expect(await metrics[0].getLabel()).toEqual('Count of foobar');
|
||||
});
|
||||
|
||||
it('should override name and label of sum metric', async () => {
|
||||
const source = new ESTermSource({
|
||||
id: '1234',
|
||||
indexPatternTitle: indexPatternTitle,
|
||||
term: termFieldName,
|
||||
metrics: metricExamples,
|
||||
indexPatternId: 'foobar',
|
||||
|
@ -54,7 +51,7 @@ describe('getMetricFields', () => {
|
|||
expect(metrics[0].getName()).toEqual('__kbnjoin__sum_of_myFieldGettingSummed__1234');
|
||||
expect(await metrics[0].getLabel()).toEqual('my custom label');
|
||||
expect(metrics[1].getName()).toEqual('__kbnjoin__count__1234');
|
||||
expect(await metrics[1].getLabel()).toEqual('Count of myIndex');
|
||||
expect(await metrics[1].getLabel()).toEqual('Count of foobar');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -114,7 +111,6 @@ 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,
|
||||
|
|
|
@ -63,9 +63,6 @@ export class ESTermSource extends AbstractESAggSource implements ITermJoinSource
|
|||
}
|
||||
return {
|
||||
...normalizedDescriptor,
|
||||
indexPatternTitle: descriptor.indexPatternTitle
|
||||
? descriptor.indexPatternTitle
|
||||
: descriptor.indexPatternId,
|
||||
term: descriptor.term!,
|
||||
type: SOURCE_TYPES.ES_TERM_SOURCE,
|
||||
};
|
||||
|
@ -109,11 +106,18 @@ export class ESTermSource extends AbstractESAggSource implements ITermJoinSource
|
|||
});
|
||||
}
|
||||
|
||||
getAggLabel(aggType: AGG_TYPE, fieldLabel: string): string {
|
||||
async getAggLabel(aggType: AGG_TYPE, fieldLabel: string): Promise<string> {
|
||||
let indexPatternLabel: string | undefined;
|
||||
try {
|
||||
const indexPattern = await this.getIndexPattern();
|
||||
indexPatternLabel = indexPattern.getName();
|
||||
} catch (error) {
|
||||
indexPatternLabel = this._descriptor.indexPatternId;
|
||||
}
|
||||
return aggType === AGG_TYPE.COUNT
|
||||
? i18n.translate('xpack.maps.source.esJoin.countLabel', {
|
||||
defaultMessage: `Count of {indexPatternTitle}`,
|
||||
values: { indexPatternTitle: this._descriptor.indexPatternTitle },
|
||||
defaultMessage: `Count of {indexPatternLabel}`,
|
||||
values: { indexPatternLabel },
|
||||
})
|
||||
: super.getAggLabel(aggType, fieldLabel);
|
||||
}
|
||||
|
@ -145,14 +149,14 @@ export class ESTermSource extends AbstractESAggSource implements ITermJoinSource
|
|||
|
||||
const rawEsData = await this._runEsQuery({
|
||||
requestId: this.getId(),
|
||||
requestName: `${this._descriptor.indexPatternTitle}.${this._termField.getName()}`,
|
||||
requestName: `${indexPattern.getName()}.${this._termField.getName()}`,
|
||||
searchSource,
|
||||
registerCancelCallback,
|
||||
requestDescription: i18n.translate('xpack.maps.source.esJoin.joinDescription', {
|
||||
defaultMessage: `Elasticsearch terms aggregation request, left source: {leftSource}, right source: {rightSource}`,
|
||||
values: {
|
||||
leftSource: `${leftSourceName}:${leftFieldName}`,
|
||||
rightSource: `${this._descriptor.indexPatternTitle}:${this._termField.getName()}`,
|
||||
rightSource: `${indexPattern.getName()}:${this._termField.getName()}`,
|
||||
},
|
||||
}),
|
||||
searchSessionId: searchFilters.searchSessionId,
|
||||
|
|
|
@ -48,7 +48,6 @@ exports[`Should render join editor 1`] = `
|
|||
"right": Object {
|
||||
"id": "673ff994-fc75-4c67-909b-69fcb0e1060e",
|
||||
"indexPatternId": "abcde",
|
||||
"indexPatternTitle": "kibana_sample_data_logs",
|
||||
"metrics": Array [
|
||||
Object {
|
||||
"label": "web logs count",
|
||||
|
|
|
@ -37,7 +37,6 @@ const defaultProps = {
|
|||
leftField: 'iso2',
|
||||
right: {
|
||||
id: '673ff994-fc75-4c67-909b-69fcb0e1060e',
|
||||
indexPatternTitle: 'kibana_sample_data_logs',
|
||||
term: 'geo.src',
|
||||
indexPatternId: 'abcde',
|
||||
metrics: [
|
||||
|
|
|
@ -95,13 +95,7 @@ export class Join extends Component<Props, State> {
|
|||
});
|
||||
};
|
||||
|
||||
_onRightSourceChange = ({
|
||||
indexPatternId,
|
||||
indexPatternTitle,
|
||||
}: {
|
||||
indexPatternId: string;
|
||||
indexPatternTitle: string;
|
||||
}) => {
|
||||
_onRightSourceChange = (indexPatternId: string) => {
|
||||
this.setState({
|
||||
rightFields: [],
|
||||
loadError: undefined,
|
||||
|
@ -113,7 +107,6 @@ export class Join extends Component<Props, State> {
|
|||
right: {
|
||||
...restOfRight,
|
||||
indexPatternId,
|
||||
indexPatternTitle,
|
||||
type: SOURCE_TYPES.ES_TERM_SOURCE,
|
||||
} as ESTermSourceDescriptor,
|
||||
});
|
||||
|
@ -183,9 +176,7 @@ export class Join extends Component<Props, State> {
|
|||
const { join, onRemove, leftFields, leftSourceName } = this.props;
|
||||
const { rightFields, indexPattern } = this.state;
|
||||
const right = _.get(join, 'right', {}) as ESTermSourceDescriptor;
|
||||
const rightSourceName = right.indexPatternTitle
|
||||
? right.indexPatternTitle
|
||||
: right.indexPatternId;
|
||||
const rightSourceName = indexPattern ? indexPattern.getName() : right.indexPatternId;
|
||||
const isJoinConfigComplete = join.leftField && right.indexPatternId && right.term;
|
||||
|
||||
let metricsExpression;
|
||||
|
|
|
@ -26,10 +26,7 @@ import { SingleFieldSelect } from '../../../../components/single_field_select';
|
|||
import { ValidatedNumberInput } from '../../../../components/validated_number_input';
|
||||
|
||||
import { getTermsFields } from '../../../../index_pattern_util';
|
||||
import {
|
||||
getIndexPatternService,
|
||||
getIndexPatternSelectComponent,
|
||||
} from '../../../../kibana_services';
|
||||
import { getIndexPatternSelectComponent } from '../../../../kibana_services';
|
||||
import type { JoinField } from '../join_editor';
|
||||
|
||||
interface Props {
|
||||
|
@ -44,13 +41,7 @@ interface Props {
|
|||
// Right source props
|
||||
rightSourceIndexPatternId: string;
|
||||
rightSourceName: string;
|
||||
onRightSourceChange: ({
|
||||
indexPatternId,
|
||||
indexPatternTitle,
|
||||
}: {
|
||||
indexPatternId: string;
|
||||
indexPatternTitle: string;
|
||||
}) => void;
|
||||
onRightSourceChange: (indexPatternId: string) => void;
|
||||
|
||||
// Right field props
|
||||
rightValue: string;
|
||||
|
@ -81,20 +72,12 @@ export class JoinExpression extends Component<Props, State> {
|
|||
});
|
||||
};
|
||||
|
||||
_onRightSourceChange = async (indexPatternId?: string) => {
|
||||
_onRightSourceChange = (indexPatternId?: string) => {
|
||||
if (!indexPatternId || indexPatternId.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const indexPattern = await getIndexPatternService().get(indexPatternId);
|
||||
this.props.onRightSourceChange({
|
||||
indexPatternId,
|
||||
indexPatternTitle: indexPattern.title,
|
||||
});
|
||||
} catch (err) {
|
||||
// do not call onChange with when unable to get indexPatternId
|
||||
}
|
||||
this.props.onRightSourceChange(indexPatternId);
|
||||
};
|
||||
|
||||
_onLeftFieldChange = (selectedFields: Array<EuiComboBoxOptionOption<JoinField>>) => {
|
||||
|
|
|
@ -12,14 +12,6 @@ import { ToolsControl } from './tools_control';
|
|||
const defaultProps = {
|
||||
initiateDraw: () => {},
|
||||
cancelDraw: () => {},
|
||||
geoFields: [
|
||||
{
|
||||
geoFieldName: 'location',
|
||||
geoFieldType: 'geo_point',
|
||||
indexPatternTitle: 'my_index',
|
||||
indexPatternId: '1',
|
||||
},
|
||||
],
|
||||
filterModeActive: false,
|
||||
activateDrawFilterMode: () => {},
|
||||
deactivateDrawMode: () => {},
|
||||
|
|
|
@ -51,7 +51,6 @@ export interface LazyLoadedMapModules {
|
|||
termsSize,
|
||||
colorSchema,
|
||||
indexPatternId,
|
||||
indexPatternTitle,
|
||||
metricAgg,
|
||||
metricFieldName,
|
||||
}: CreateRegionMapLayerDescriptorParams) => LayerDescriptor | null;
|
||||
|
|
|
@ -29,7 +29,6 @@ export function extractLayerDescriptorParams(vis: Vis<RegionMapVisParams>) {
|
|||
leftFieldName: vis.params.selectedLayer.isEMS ? vis.params.selectedJoinField.name : undefined,
|
||||
colorSchema: vis.params.colorSchema,
|
||||
indexPatternId: vis.data.indexPattern?.id,
|
||||
indexPatternTitle: vis.data.indexPattern?.title,
|
||||
metricAgg: 'count',
|
||||
};
|
||||
|
||||
|
|
|
@ -186,7 +186,6 @@ export interface MapsAppRegionMapLocatorParams extends SerializableRecord {
|
|||
termsSize?: number;
|
||||
colorSchema: string;
|
||||
indexPatternId?: string;
|
||||
indexPatternTitle?: string;
|
||||
metricAgg: string;
|
||||
metricFieldName?: string;
|
||||
timeRange?: TimeRange;
|
||||
|
@ -219,7 +218,6 @@ export class MapsAppRegionMapLocatorDefinition
|
|||
termsSize,
|
||||
colorSchema,
|
||||
indexPatternId,
|
||||
indexPatternTitle,
|
||||
metricAgg,
|
||||
metricFieldName,
|
||||
filters,
|
||||
|
@ -237,7 +235,6 @@ export class MapsAppRegionMapLocatorDefinition
|
|||
termsSize,
|
||||
colorSchema,
|
||||
indexPatternId,
|
||||
indexPatternTitle,
|
||||
metricAgg,
|
||||
metricFieldName,
|
||||
});
|
||||
|
|
|
@ -18256,7 +18256,6 @@
|
|||
"xpack.maps.source.esGrid.compositeInspectorDescription": "Demande d'agrégation de grille géographique Elasticsearch : {requestId}",
|
||||
"xpack.maps.source.esGrid.compositePaginationErrorMessage": "{layerName} génère trop de requêtes. Réduisez \"Résolution de la grille\" et/ou réduisez le nombre d'indicateurs de premier terme.",
|
||||
"xpack.maps.source.esGrid.resolutionParamErrorMessage": "Paramètre de résolution de grille non reconnu : {resolution}",
|
||||
"xpack.maps.source.esJoin.countLabel": "Compte de {indexPatternTitle}",
|
||||
"xpack.maps.source.esJoin.joinDescription": "Demande d'agrégation des termes Elasticsearch, source gauche : {leftSource}, source droite : {rightSource}",
|
||||
"xpack.maps.source.esSearch.clusterScalingLabel": "Afficher les clusters lorsque les résultats dépassent {maxResultWindow}",
|
||||
"xpack.maps.source.esSearch.convertToGeoJsonErrorMsg": "Impossible de convertir la réponse de la recherche à la collecte de fonctionnalités geoJson, erreur : {errorMsg}",
|
||||
|
@ -18264,7 +18263,6 @@
|
|||
"xpack.maps.source.esSearch.loadTooltipPropertiesErrorMsg": "Document introuvable, _id : {docId}",
|
||||
"xpack.maps.source.esSearch.mvtDisableReason": "L'API de tuile vectorielle ne prend pas en charge le champ de runtime {type}",
|
||||
"xpack.maps.source.esSearch.mvtScalingJoinMsg": "Les tuiles vectorielles prennent en charge une seule liaison de terme. Votre calque comporte {numberOfJoins} liaisons de terme. Le passage aux tuiles vectorielles conservera la première liaison de terme et supprimera toutes les autres liaisons de terme de votre configuration de calque.",
|
||||
"xpack.maps.source.esSource.noGeoFieldErrorMessage": "La vue de données {indexPatternTitle} ne contient plus le champ géographique {geoField}.",
|
||||
"xpack.maps.source.esSource.requestFailedErrorMessage": "Échec de la demande de recherche Elasticsearch, erreur : {message}",
|
||||
"xpack.maps.source.esSource.stylePropsMetaRequestName": "{layerName} - métadonnées",
|
||||
"xpack.maps.source.MVTSingleLayerVectorSourceEditor.urlHelpMessage": "URL du service de cartographie vectoriel .mvt. Par ex. {url}",
|
||||
|
@ -18712,7 +18710,6 @@
|
|||
"xpack.maps.source.esSearch.clusterScalingJoinMsg": "La montée en charge avec les clusters ne prend pas en charge les liaisons de terme. Le passage aux clusters entraînera la suppression de toutes les liaisons de terme de la configuration de calque.",
|
||||
"xpack.maps.source.esSearch.descendingLabel": "décroissant",
|
||||
"xpack.maps.source.esSearch.extentFilterLabel": "Filtre dynamique pour les données de la zone de carte visible",
|
||||
"xpack.maps.source.esSearch.fieldNotFoundMsg": "Impossible de trouver \"{fieldName}\" dans le modèle d'indexation \"{indexPatternTitle}\".",
|
||||
"xpack.maps.source.esSearch.geofieldLabel": "Champ géospatial",
|
||||
"xpack.maps.source.esSearch.geoFieldLabel": "Champ géospatial",
|
||||
"xpack.maps.source.esSearch.geoFieldTypeLabel": "Type de champ géospatial",
|
||||
|
|
|
@ -18241,7 +18241,6 @@
|
|||
"xpack.maps.source.esGrid.compositeInspectorDescription": "Elasticsearch ジオグリッド集約リクエスト:{requestId}",
|
||||
"xpack.maps.source.esGrid.compositePaginationErrorMessage": "{layerName} はリクエスト過多の原因になります。「グリッド解像度」を下げるか、またはトップ用語「メトリック」の数を減らしてください。",
|
||||
"xpack.maps.source.esGrid.resolutionParamErrorMessage": "グリッド解像度パラメーターが認識されません:{resolution}",
|
||||
"xpack.maps.source.esJoin.countLabel": "{indexPatternTitle} の件数",
|
||||
"xpack.maps.source.esJoin.joinDescription": "Elasticsearch 用語集約リクエスト、左ソース:{leftSource}、右ソース:{rightSource}",
|
||||
"xpack.maps.source.esSearch.clusterScalingLabel": "結果が{maxResultWindow}を超えたらクラスターを表示",
|
||||
"xpack.maps.source.esSearch.convertToGeoJsonErrorMsg": "検索への応答を geoJson 機能コレクションに変換できません。エラー:{errorMsg}",
|
||||
|
@ -18249,7 +18248,6 @@
|
|||
"xpack.maps.source.esSearch.loadTooltipPropertiesErrorMsg": "ドキュメントが見つかりません。_id:{docId}",
|
||||
"xpack.maps.source.esSearch.mvtDisableReason": "ベクトルタイルAPIは、ランタイム{type}フィールドをサポートしません",
|
||||
"xpack.maps.source.esSearch.mvtScalingJoinMsg": "ベクトルタイルは1つの用語結合をサポートします。レイヤーには{numberOfJoins}個の用語結合があります。ベクトルタイルに切り替えると、最初の用語結合が保持され、すべての他の用語結合がレイヤー構成から削除されます。",
|
||||
"xpack.maps.source.esSource.noGeoFieldErrorMessage": "データビュー{indexPatternTitle}には現在ジオフィールド{geoField}が含まれていません",
|
||||
"xpack.maps.source.esSource.requestFailedErrorMessage": "Elasticsearch 検索リクエストに失敗。エラー:{message}",
|
||||
"xpack.maps.source.esSource.stylePropsMetaRequestName": "{layerName} - メタデータ",
|
||||
"xpack.maps.source.MVTSingleLayerVectorSourceEditor.urlHelpMessage": ".mvtベクトルタイルサービスのURL。例:{url}",
|
||||
|
@ -18697,7 +18695,6 @@
|
|||
"xpack.maps.source.esSearch.clusterScalingJoinMsg": "クラスターのスケーリングは用語結合をサポートしていません。クラスターに切り替えると、すべての用語結合がレイヤー構成から削除されます。",
|
||||
"xpack.maps.source.esSearch.descendingLabel": "降順",
|
||||
"xpack.maps.source.esSearch.extentFilterLabel": "マップの表示範囲でデータを動的にフィルタリング",
|
||||
"xpack.maps.source.esSearch.fieldNotFoundMsg": "インデックスパターン'{indexPatternTitle}'に'{fieldName}'が見つかりません。",
|
||||
"xpack.maps.source.esSearch.geofieldLabel": "地理空間フィールド",
|
||||
"xpack.maps.source.esSearch.geoFieldLabel": "地理空間フィールド",
|
||||
"xpack.maps.source.esSearch.geoFieldTypeLabel": "地理空間フィールドタイプ",
|
||||
|
|
|
@ -18263,7 +18263,6 @@
|
|||
"xpack.maps.source.esGrid.compositeInspectorDescription": "Elasticsearch 地理网格聚合请求:{requestId}",
|
||||
"xpack.maps.source.esGrid.compositePaginationErrorMessage": "{layerName} 正导致过多的请求。降低“网格分辨率”和/或减少热门词“指标”的数量。",
|
||||
"xpack.maps.source.esGrid.resolutionParamErrorMessage": "无法识别网格分辨率参数:{resolution}",
|
||||
"xpack.maps.source.esJoin.countLabel": "{indexPatternTitle} 的计数",
|
||||
"xpack.maps.source.esJoin.joinDescription": "Elasticsearch 词聚合请求,左源:{leftSource},右源:{rightSource}",
|
||||
"xpack.maps.source.esSearch.clusterScalingLabel": "结果超过 {maxResultWindow} 个时显示集群",
|
||||
"xpack.maps.source.esSearch.convertToGeoJsonErrorMsg": "无法将搜索响应转换成 geoJson 功能集合,错误:{errorMsg}",
|
||||
|
@ -18271,7 +18270,6 @@
|
|||
"xpack.maps.source.esSearch.loadTooltipPropertiesErrorMsg": "找不到文档,_id:{docId}",
|
||||
"xpack.maps.source.esSearch.mvtDisableReason": "矢量磁帖 API 不支持运行时 {type} 字段",
|
||||
"xpack.maps.source.esSearch.mvtScalingJoinMsg": "矢量磁贴支持一个词联接。您的图层具有 {numberOfJoins} 个词联接。切换到矢量磁贴会保留第一个词联接,并从图层配置中移除所有其他词联接。",
|
||||
"xpack.maps.source.esSource.noGeoFieldErrorMessage": "数据视图 {indexPatternTitle} 不再包含地理字段 {geoField}",
|
||||
"xpack.maps.source.esSource.requestFailedErrorMessage": "Elasticsearch 搜索请求失败,错误:{message}",
|
||||
"xpack.maps.source.esSource.stylePropsMetaRequestName": "{layerName} - 元数据",
|
||||
"xpack.maps.source.MVTSingleLayerVectorSourceEditor.urlHelpMessage": ".mvt 矢量磁帖服务的 URL。例如 {url}",
|
||||
|
@ -18719,7 +18717,6 @@
|
|||
"xpack.maps.source.esSearch.clusterScalingJoinMsg": "与集群一起缩放不支持词联接。切换到集群将从您的图层配置中移除所有词联接。",
|
||||
"xpack.maps.source.esSearch.descendingLabel": "降序",
|
||||
"xpack.maps.source.esSearch.extentFilterLabel": "在可见地图区域中动态筛留数据",
|
||||
"xpack.maps.source.esSearch.fieldNotFoundMsg": "在索引模式“{indexPatternTitle}”中找不到“{fieldName}”。",
|
||||
"xpack.maps.source.esSearch.geofieldLabel": "地理空间字段",
|
||||
"xpack.maps.source.esSearch.geoFieldLabel": "地理空间字段",
|
||||
"xpack.maps.source.esSearch.geoFieldTypeLabel": "地理空间字段类型",
|
||||
|
|
|
@ -16,7 +16,6 @@ export const mockLayerList = [
|
|||
applyGlobalTime: true,
|
||||
type: 'ES_TERM_SOURCE',
|
||||
id: '3657625d-17b0-41ef-99ba-3a2b2938655c',
|
||||
indexPatternTitle: 'apm-*',
|
||||
term: 'client.geo.country_iso_code',
|
||||
whereQuery: {
|
||||
language: 'kuery',
|
||||
|
@ -94,7 +93,6 @@ export const mockLayerList = [
|
|||
applyGlobalTime: true,
|
||||
type: 'ES_TERM_SOURCE',
|
||||
id: 'e62a1b9c-d7ff-4fd4-a0f6-0fdc44bb9e41',
|
||||
indexPatternTitle: 'apm-*',
|
||||
term: 'client.geo.region_iso_code',
|
||||
whereQuery: {
|
||||
language: 'kuery',
|
||||
|
|
|
@ -32,7 +32,6 @@ import { APM_STATIC_INDEX_PATTERN_ID } from '../../../../../common/index_pattern
|
|||
const ES_TERM_SOURCE_COUNTRY: ESTermSourceDescriptor = {
|
||||
type: SOURCE_TYPES.ES_TERM_SOURCE,
|
||||
id: '3657625d-17b0-41ef-99ba-3a2b2938655c',
|
||||
indexPatternTitle: 'apm-*',
|
||||
term: 'client.geo.country_iso_code',
|
||||
metrics: [
|
||||
{
|
||||
|
@ -50,7 +49,6 @@ const ES_TERM_SOURCE_COUNTRY: ESTermSourceDescriptor = {
|
|||
const ES_TERM_SOURCE_REGION: ESTermSourceDescriptor = {
|
||||
type: SOURCE_TYPES.ES_TERM_SOURCE,
|
||||
id: 'e62a1b9c-d7ff-4fd4-a0f6-0fdc44bb9e41',
|
||||
indexPatternTitle: 'apm-*',
|
||||
term: 'client.geo.region_iso_code',
|
||||
metrics: [{ type: AGG_TYPE.AVG, field: 'transaction.duration.us' }],
|
||||
whereQuery: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue