Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/ui/public/agg_types/buckets/create_filter/ip_range.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ export default function createIpRangeFilterProvider() {
if (aggConfig.params.ipRangeType === 'mask') {
range = new CidrMask(key).getRange();
} else {
let addresses = key.split(/\-/);
let [from, to] = key.split(/\s+to\s+/);
range = {
from: addresses[0],
to: addresses[1]
from: from === '-Infinity' ? -Infinity : from,
to: to === 'Infinity' ? Infinity : to
};
}

Expand Down
7 changes: 3 additions & 4 deletions src/ui/public/agg_types/buckets/ip_range.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ export default function RangeAggDefinition(Private) {
createFilter: createFilter,
getKey: function (bucket, key, agg) {
if (key) return key;

const from = _.get(bucket, 'from', '*');
const to = _.get(bucket, 'to', '*');
return `${from}-${to}`;
const from = _.get(bucket, 'from', '-Infinity');
const to = _.get(bucket, 'to', 'Infinity');
return `${from} to ${to}`;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used * because that's what ES used in it's key prop in 2.x. Are there any backwards compatibility concerns with changing it? (I'm not super familiar with getKey's usage so I'm not sure). If not, being consistent with the filter labels sounds like a good idea to me.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just discovered open ended ip range filters fail in 4.x as well, so this is probably a good change to make regardless and backport it. Still curious if there are any BC concerns other than just the label changing in the UI?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There shouldn't be any BWC issue. getKey() just needs to return a unique string per bucket

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool LGTM

},
makeLabel: function (aggConfig) {
return aggConfig.getFieldDisplayName() + ' IP ranges';
Expand Down