Skip to content

Commit

Permalink
♻️ Refactor time field getter for update consistency + tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dej611 committed Dec 14, 2020
1 parent be0372f commit 6ca7d39
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const stubIndexPattern: IIndexPattern = {
fields: stubFields,
title: 'logstash-*',
timeFieldName: '@timestamp',
getTimeField: () => ({ name: '@timestamp', type: 'date' }),
};

export const stubIndexPatternWithFields: IIndexPattern = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export const getDateHistogramBucketAgg = ({
type: 'field',
filterFieldTypes: KBN_FIELD_TYPES.DATE,
default(agg: IBucketDateHistogramAggConfig) {
return agg.getIndexPattern().timeFieldName;
return agg.getIndexPattern().getTimeField?.()?.name;
},
onChange(agg: IBucketDateHistogramAggConfig) {
if (isAutoInterval(get(agg, 'params.interval')) && !agg.fieldIsTimeField()) {
Expand Down

0 comments on commit 6ca7d39

Please sign in to comment.