Skip to content

Commit

Permalink
fix consumers
Browse files Browse the repository at this point in the history
  • Loading branch information
flash1293 committed Nov 17, 2021
1 parent e6426f9 commit 99673cd
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 13 deletions.
3 changes: 2 additions & 1 deletion x-pack/examples/embedded_lens_example/public/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
PersistedIndexPatternLayer,
XYState,
LensEmbeddableInput,
DateHistogramIndexPatternColumn,
} from '../../../plugins/lens/public';
import { StartDependencies } from './plugin';

Expand Down Expand Up @@ -55,7 +56,7 @@ function getLensAttributes(
params: { interval: 'auto' },
scale: 'interval',
sourceField: defaultIndexPattern.timeFieldName!,
},
} as DateHistogramIndexPatternColumn,
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,18 @@ import type { Filter } from '@kbn/es-query';
import type { IndexPattern } from '../../../../../../../../../src/plugins/data/common';
import type { CombinedQuery } from '../../../../index_data_visualizer/types/combined_query';
import type {
IndexPatternColumn,
DateHistogramIndexPatternColumn,
GenericIndexPatternColumn,
RangeIndexPatternColumn,
TermsIndexPatternColumn,
TypedLensByValueInput,
XYLayerConfig,
} from '../../../../../../../lens/public';
import { FieldVisConfig } from '../../stats_table/types';
import { JOB_FIELD_TYPES } from '../../../../../../common';

interface ColumnsAndLayer {
columns: Record<string, IndexPatternColumn>;
columns: Record<string, GenericIndexPatternColumn>;
layer: XYLayerConfig;
}

Expand All @@ -32,7 +35,7 @@ const COUNT = i18n.translate('xpack.dataVisualizer.index.lensChart.countLabel',
export function getNumberSettings(item: FieldVisConfig, defaultIndexPattern: IndexPattern) {
// if index has no timestamp field
if (defaultIndexPattern.timeFieldName === undefined) {
const columns: Record<string, IndexPatternColumn> = {
const columns: Record<string, GenericIndexPatternColumn> = {
col1: {
label: item.fieldName!,
dataType: 'number',
Expand All @@ -44,7 +47,7 @@ export function getNumberSettings(item: FieldVisConfig, defaultIndexPattern: Ind
ranges: [],
},
sourceField: item.fieldName!,
},
} as RangeIndexPatternColumn,
col2: {
label: COUNT,
dataType: 'number',
Expand All @@ -64,7 +67,7 @@ export function getNumberSettings(item: FieldVisConfig, defaultIndexPattern: Ind
return { columns, layer };
}

const columns: Record<string, IndexPatternColumn> = {
const columns: Record<string, GenericIndexPatternColumn> = {
col2: {
dataType: 'number',
isBucketed: false,
Expand All @@ -83,7 +86,7 @@ export function getNumberSettings(item: FieldVisConfig, defaultIndexPattern: Ind
params: { interval: 'auto' },
scale: 'interval',
sourceField: defaultIndexPattern.timeFieldName!,
},
} as DateHistogramIndexPatternColumn,
};

const layer: XYLayerConfig = {
Expand All @@ -97,7 +100,7 @@ export function getNumberSettings(item: FieldVisConfig, defaultIndexPattern: Ind
return { columns, layer };
}
export function getDateSettings(item: FieldVisConfig) {
const columns: Record<string, IndexPatternColumn> = {
const columns: Record<string, GenericIndexPatternColumn> = {
col2: {
dataType: 'number',
isBucketed: false,
Expand All @@ -114,7 +117,7 @@ export function getDateSettings(item: FieldVisConfig) {
params: { interval: 'auto' },
scale: 'interval',
sourceField: item.fieldName!,
},
} as DateHistogramIndexPatternColumn,
};
const layer: XYLayerConfig = {
accessors: ['col2'],
Expand All @@ -128,7 +131,7 @@ export function getDateSettings(item: FieldVisConfig) {
}

export function getKeywordSettings(item: FieldVisConfig) {
const columns: Record<string, IndexPatternColumn> = {
const columns: Record<string, GenericIndexPatternColumn> = {
col1: {
label: TOP_VALUES_LABEL,
dataType: 'string',
Expand All @@ -140,7 +143,7 @@ export function getKeywordSettings(item: FieldVisConfig) {
orderDirection: 'desc',
},
sourceField: item.fieldName!,
},
} as TermsIndexPatternColumn,
col2: {
label: COUNT,
dataType: 'number',
Expand All @@ -161,7 +164,7 @@ export function getKeywordSettings(item: FieldVisConfig) {
}

export function getBooleanSettings(item: FieldVisConfig) {
const columns: Record<string, IndexPatternColumn> = {
const columns: Record<string, GenericIndexPatternColumn> = {
col1: {
label: TOP_VALUES_LABEL,
dataType: 'string',
Expand All @@ -173,7 +176,7 @@ export function getBooleanSettings(item: FieldVisConfig) {
orderDirection: 'desc',
},
sourceField: item.fieldName!,
},
} as TermsIndexPatternColumn,
col2: {
label: COUNT,
dataType: 'number',
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/lens/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export type {
PersistedIndexPatternLayer,
OperationType,
IncompleteColumn,
GenericIndexPatternColumn,
FieldBasedIndexPatternColumn,
FiltersIndexPatternColumn,
RangeIndexPatternColumn,
TermsIndexPatternColumn,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export type {
GenericIndexPatternColumn,
OperationType,
IncompleteColumn,
FieldBasedIndexPatternColumn,
FiltersIndexPatternColumn,
RangeIndexPatternColumn,
TermsIndexPatternColumn,
Expand Down

0 comments on commit 99673cd

Please sign in to comment.