mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
track and report status from segmented fetch
This commit is contained in:
parent
4dc5f83b13
commit
db5761551a
2 changed files with 21 additions and 2 deletions
4
TODOS.md
4
TODOS.md
|
@ -5,9 +5,9 @@
|
|||
- change this from event based to calling a method on dashboardApp – [L68](https://github.com/elasticsearch/kibana4/blob/master/src/kibana/apps/dashboard/directives/grid.js#L68)
|
||||
- **src/kibana/apps/discover/controllers/discover.js**
|
||||
- Switch this to watching time.string when we implement it – [L150](https://github.com/elasticsearch/kibana4/blob/master/src/kibana/apps/discover/controllers/discover.js#L150)
|
||||
- On array fields, negating does not negate the combination, rather all terms – [L467](https://github.com/elasticsearch/kibana4/blob/master/src/kibana/apps/discover/controllers/discover.js#L467)
|
||||
- Move to utility class – [L538](https://github.com/elasticsearch/kibana4/blob/master/src/kibana/apps/discover/controllers/discover.js#L538)
|
||||
- On array fields, negating does not negate the combination, rather all terms – [L477](https://github.com/elasticsearch/kibana4/blob/master/src/kibana/apps/discover/controllers/discover.js#L477)
|
||||
- Move to utility class – [L548](https://github.com/elasticsearch/kibana4/blob/master/src/kibana/apps/discover/controllers/discover.js#L548)
|
||||
- Move to utility class – [L558](https://github.com/elasticsearch/kibana4/blob/master/src/kibana/apps/discover/controllers/discover.js#L558)
|
||||
- **src/kibana/apps/settings/sections/indices/_create.js**
|
||||
- we should probably display a message of some kind – [L111](https://github.com/elasticsearch/kibana4/blob/master/src/kibana/apps/settings/sections/indices/_create.js#L111)
|
||||
- **src/kibana/apps/visualize/controllers/editor.js**
|
||||
|
|
|
@ -29,6 +29,7 @@ define(function (require) {
|
|||
* @return {Promise}
|
||||
*/
|
||||
segmentedFetch.fetch = function (opts) {
|
||||
opts = opts || {};
|
||||
var searchSource = opts.searchSource;
|
||||
var direction = opts.direction;
|
||||
var limitSize = false;
|
||||
|
@ -48,6 +49,9 @@ define(function (require) {
|
|||
activeReq = req;
|
||||
|
||||
var queue = searchSource.get('index').toIndexList();
|
||||
var total = queue.length;
|
||||
var active = null;
|
||||
var complete = [];
|
||||
|
||||
if (!_.isArray(queue)) {
|
||||
queue = [queue];
|
||||
|
@ -67,10 +71,24 @@ define(function (require) {
|
|||
}
|
||||
};
|
||||
|
||||
function reportStatus() {
|
||||
if (!opts.status) return;
|
||||
opts.status({
|
||||
total: total,
|
||||
complete: complete.length,
|
||||
remaining: queue.length,
|
||||
active: active
|
||||
});
|
||||
}
|
||||
|
||||
reportStatus();
|
||||
getStateFromRequest(req)
|
||||
.then(function (state) {
|
||||
return (function recurse() {
|
||||
var index = queue.shift();
|
||||
active = index;
|
||||
|
||||
reportStatus();
|
||||
|
||||
if (limitSize) {
|
||||
state.body.size = remainingSize;
|
||||
|
@ -133,6 +151,7 @@ define(function (require) {
|
|||
}
|
||||
})
|
||||
.then(function () {
|
||||
complete.push(index);
|
||||
if (queue.length) return recurse();
|
||||
return done();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue