diff --git a/api/js/etemplate/et2_dataview_controller_selection.ts b/api/js/etemplate/et2_dataview_controller_selection.ts
index 03daf59a90..42ba515f7a 100644
--- a/api/js/etemplate/et2_dataview_controller_selection.ts
+++ b/api/js/etemplate/et2_dataview_controller_selection.ts
@@ -668,15 +668,17 @@ export class et2_dataview_selectionManager
_query_ranges(queryRanges)
{
- var that = this;
- var record_count = 0;
- var range_index = 0;
- var range_count = queryRanges.length;
- var cont = true;
- var fetchPromise = new Promise(function(resolve)
+ let that = this;
+ let record_count = 0;
+ let range_index = 0;
+ let range_count = queryRanges.length;
+ let cont = true;
+ let fetchResolver;
+ let fetchPromise = new Promise(function(resolve)
{
- resolve();
+ fetchResolver = resolve;
});
+ let fetchList = [fetchPromise];
// Found after dialog loads
var progressbar;
@@ -696,61 +698,67 @@ export class et2_dataview_selectionManager
}],
width: 300
});
- (this._context._widget.getDOMNode() || document.body).appendChild(dialog);
+ (this._context._widget.getDOMNode() || document.body).append(dialog);
dialog.updateComplete.then(() =>
{
- dialog.template.DOMContainer.addEventListener('load', function()
+ dialog.template.DOMContainer.addEventListener('load', () =>
{
// Get access to template widgets
progressbar = dialog.template.widgetContainer.getWidgetById('progressbar');
- });
- });
+ let rangePromise = fetchPromise;
- for(var i = 0; i < queryRanges.length; i++)
- {
- if(record_count + (queryRanges[i].bottom - queryRanges[i].top + 1) > that.MAX_SELECTION)
- {
- egw.message(egw.lang('Too many rows selected.
Select all, or less than %1 rows', that.MAX_SELECTION));
- break;
- }
- else
- {
- record_count += (queryRanges[i].bottom - queryRanges[i].top + 1);
- fetchPromise = fetchPromise.then((function()
+ for(var i = 0; i < queryRanges.length; i++)
{
- // Check for abort
- if(!cont)
+ if(record_count + (queryRanges[i].bottom - queryRanges[i].top + 1) > et2_dataview_selectionManager.MAX_SELECTION)
{
- return;
+ egw.message(egw.lang('Too many rows selected.
Select all, or less than %1 rows', et2_dataview_selectionManager.MAX_SELECTION));
+ break;
}
-
- return new Promise(function(resolve)
+ else
{
- that._queryRangeCallback.call(that._context, this,
- function(_order)
+ record_count += (queryRanges[i].bottom - queryRanges[i].top + 1);
+ // We want to chain these one after the other, not fire them all right away
+ rangePromise = rangePromise.then((function()
+ {
+ // Check for abort
+ if(!cont)
{
- for(var j = 0; j < _order.length; j++)
- {
- // Check for no_actions flag via data since entry isn't there/available
- var data = egw.dataGetUIDdata(_order[j]);
- if(!data || data && data.data && !data.data.no_actions)
- {
- var entry = this._getRegisteredRowsEntry(_order[j]);
- this._updateEntryState(entry,
- egwSetBit(entry.state, EGW_AO_STATE_SELECTED, true));
- }
+ return;
}
- progressbar.set_value(100*(++range_index/range_count));
- resolve();
- }, that);
- }.bind(this));
- }).bind(queryRanges[i]));
- }
- }
- fetchPromise.finally(function() {
- dialog.close();
+
+ return new Promise(function(resolve)
+ {
+ that._queryRangeCallback.call(that._context, this,
+ function(_order)
+ {
+ for(var j = 0; j < _order.length; j++)
+ {
+ // Check for no_actions flag via data since entry isn't there/available
+ var data = egw.dataGetUIDdata(_order[j]);
+ if(!data || data && data.data && !data.data.no_actions)
+ {
+ var entry = this._getRegisteredRowsEntry(_order[j]);
+ this._updateEntryState(entry,
+ egwSetBit(entry.state, EGW_AO_STATE_SELECTED, true));
+ }
+ }
+ progressbar.set_value(100 * (++range_index / range_count));
+ resolve();
+ }, that);
+ }.bind(this));
+ }).bind(queryRanges[i]));
+ fetchList.push(rangePromise);
+ }
+ }
+
+ // Start the first fetch
+ fetchResolver();
+ Promise.all(fetchList).finally(function()
+ {
+ dialog.close();
+ });
+ })
});
}
-
}
diff --git a/api/templates/default/long_task.xet b/api/templates/default/long_task.xet
index 6c37182c6d..82bf757498 100644
--- a/api/templates/default/long_task.xet
+++ b/api/templates/default/long_task.xet
@@ -12,17 +12,17 @@
- .long_task .ui-dialog-content {
- width: 90%;
- }
- .long_task .log {
- max-height: 10em;
- overflow: auto;
- }
- .long_task .et2_progress {
- width: 100%;
- height: 1em;
- }
-
+ #long_task > div {
+ width: 100%;
+ }
+ .long_task .log {
+ max-height: 10em;
+ overflow: auto;
+ }
+ .long_task .et2_progress {
+ width: 100%;
+ height: 1em;
+ }
+
\ No newline at end of file