-
Notifications
You must be signed in to change notification settings - Fork 14
Optionally split array field in multiple instances #107
base: master
Are you sure you want to change the base?
Conversation
This adds the feature to get arrays from the es result document, by reusing kibiUtils.getValuesAtPath with .split('.'). This feature might be implemented on a higher level of abstraction, to get rid of params.labelFieldSequence statements altogether.
Can one of the admins verify this patch? |
name="splitOnArray" | ||
ng-model="group.splitOnArray"> | ||
Show values in array field as seperate instances | ||
<kbn-info info="Show seperate instances for every field in an field with multiple values. When unchecked, the values will be combined by a comma."></kbn-info> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for every field in an field with multiple values
for every value in a multi-valued field
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, added commit that fixes the typo de27891
if (startFieldValue && startFieldValue.constructor !== Array) { | ||
startFieldValue = [ startFieldValue ]; | ||
} | ||
if (labelValues.constructor !== Array) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you merge this with the previous condition ? labelValues.constructor !== Array
is repeated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the constructor changes in the condition preceding the condition that creates an array, that is not preferable.
@@ -394,3 +401,4 @@ define(function (require) { | |||
} // end of link function | |||
}); | |||
}); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove extra whitespace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The nesting in the loop requires the 2 spaces additional indentation for readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems some comments I made last time didn't go through somehow, sorry about that.
Please remove target/kibi_timeline_vis-4.6.3.zip
from the PR.
I'll give this PR a last run test and it should be good to go.
field = _.get(hit._source, params.labelField); | ||
} else { // create kibi path property from ES path by splitting on . | ||
const kibanaSplit = params.labelField.split('.'); | ||
const kibanaSequence = Array.isArray(kibanaSplit) ? kibanaSplit : Array.of(kibanaSplit); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable kibanaSplit
is always an array, isn't it ? If so, why is the check Array.isArray
needed ?
Left kibanaSequence as const to clarify code
@RubieV please rebase on master to resolve conflicts |
@scampi is this related to anything we have worked on recently, is it worth merging? |
@mikehug not recently, this is a feature that was pushed for by OP to improve readability imo of an event with multiple label. |
Based on patch-1, adds the option to split array field into multiple instances, instead of joining on ', '. Integration tests have not been added.