Skip to content

Commit

Permalink
move logic to functions
Browse files Browse the repository at this point in the history
  • Loading branch information
nreese committed Jun 23, 2017
1 parent 6f96bb3 commit 90ca50e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/ui/public/utils/brush_event.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ export function UtilsBrushEventProvider(timefilter) {

if (event.data.xAxisField.type === 'date' &&
event.data.xAxisField.name === event.data.indexPattern.timeFieldName) {
setTimefilter();
} else if (event.data.xAxisField.type === 'date' || event.data.xAxisField.type === 'number') {
setRange();
}

function setTimefilter() {
const from = moment(event.range[0]);
const to = moment(event.range[1]);

Expand All @@ -19,7 +25,9 @@ export function UtilsBrushEventProvider(timefilter) {
timefilter.time.from = from;
timefilter.time.to = to;
timefilter.time.mode = 'absolute';
} else if (event.data.xAxisField.type === 'date' || event.data.xAxisField.type === 'number') {
}

function setRange() {
if (event.range.length <= 1) return;

const existingFilter = $state.filters.find(filter => (
Expand Down

0 comments on commit 90ca50e

Please sign in to comment.