Skip to content

Commit

Permalink
apply comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alexwizp committed Sep 21, 2021
1 parent 561e27a commit 3e70181
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,24 @@ describe('shouldShowDeprecatedHistogramIntervalInfo', () => {
});

test('should not show deprecated histogram interval', () => {
expect(
shouldShowDeprecatedHistogramIntervalInfo({
data: {
url: {
body: {
aggs: {
test: {
date_histogram: {
interval: { '%autointerval%': true },
},
},
},
},
},
},
})
).toBeFalsy();

expect(
shouldShowDeprecatedHistogramIntervalInfo({
data: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ export const shouldShowDeprecatedHistogramIntervalInfo = (spec: VegaSpec) => {

return data.some((dataItem) => {
const aggs = dataItem.url?.body?.aggs ?? {};
return Object.keys(aggs).some(
(key) => 'interval' in (aggs[key]?.[BUCKET_TYPES.DATE_HISTOGRAM] || {})
);

return Object.keys(aggs).some((key) => {
const dateHistogram = aggs[key]?.[BUCKET_TYPES.DATE_HISTOGRAM] || {};
return 'interval' in dateHistogram && typeof dateHistogram.interval !== 'object';
});
});
};
14 changes: 11 additions & 3 deletions src/plugins/vis_types/vega/public/default.spec.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,19 @@ See .search() documentation for : https://www.elastic.co/guide/en/elasticsearch
body: {
aggs: {
time_buckets: {
auto_date_histogram: {
// Use auto date histogram aggregation on @timestamp field
date_histogram: {
// Use date histogram aggregation on @timestamp field
field: @timestamp
// The interval value will depend on the daterange picker (true), or use an integer to set an approximate bucket count
interval: {%autointerval%: true}
// Make sure we get an entire range, even if it has no data
buckets: 50
extended_bounds: {
// Use the current time range's start and end
min: {%timefilter%: "min"}
max: {%timefilter%: "max"}
}
// Use this for linear (e.g. line, area) graphs. Without it, empty buckets will not show up
min_doc_count: 0
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions test/functional/apps/visualize/_vega_chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
const retry = getService('retry');
const browser = getService('browser');

// SKIPPED: https://github.com/elastic/kibana/issues/106352
describe.skip('vega chart in visualize app', () => {
describe('vega chart in visualize app', () => {
before(async () => {
await PageObjects.visualize.initTests();
log.debug('navigateToApp visualize');
Expand Down

0 comments on commit 3e70181

Please sign in to comment.