mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
* dont add value outside of range * handle last being over max * return NaN for next when list is empty
This commit is contained in:
parent
010a998bac
commit
593423bd46
1 changed files with 16 additions and 1 deletions
|
@ -88,7 +88,22 @@ uiModules
|
|||
const list = self.getList();
|
||||
if (!list) return;
|
||||
|
||||
list.push(_.last(list) + 1);
|
||||
function getNext() {
|
||||
if (list.length === 0) {
|
||||
// returning NaN adds an empty input
|
||||
return NaN;
|
||||
}
|
||||
|
||||
const next = _.last(list) + 1;
|
||||
if (next < self.range.max) {
|
||||
return next;
|
||||
}
|
||||
|
||||
return self.range.max - 1;
|
||||
}
|
||||
|
||||
const next = getNext();
|
||||
list.push(next);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue