A temporary fix for commit 471741ce12 which breaks nm row update with auto refresh enabled

This commit is contained in:
Hadi Nategh 2020-08-12 12:04:03 +02:00 committed by Ralf Becker
parent e238b8b2a2
commit 3b0a1bef0b
4 changed files with 41 additions and 6 deletions

View File

@ -88,6 +88,18 @@ var et2_dataview_controller = /** @class */ (function () {
} }
} }
}; };
/**
* Enable or disable autorefresh
*
* disable_autorefresh is used to detect that we have active push in order to enable a fix for push
* on _insertDataRow function reindexing the _indexMap which is wrong for the full refresh.
*
* @param disabled
* @todo remove it after finding a right fix
*/
et2_dataview_controller.prototype.set_disable_autorefresh = function (disabled) {
this._disable_autorefresh = disabled;
};
/** /**
* @param value is an object implementing the et2_IDataProvider * @param value is an object implementing the et2_IDataProvider
* interface * interface
@ -331,8 +343,9 @@ var et2_dataview_controller = /** @class */ (function () {
if (createdRow && _entry.row) { if (createdRow && _entry.row) {
this._grid.insertRow(_entry.idx, _entry.row); this._grid.insertRow(_entry.idx, _entry.row);
} }
// Update index map //@todo remove it after finding a right fix
if (this._indexMap[_entry.idx].uid !== _entry.uid) { // Update index map only for push (autorefresh disabled)
if (this._disable_autorefresh && this._indexMap[_entry.idx].uid !== _entry.uid) {
var max = parseInt(Object.keys(this._indexMap).reduce(function (a, b) { return _this._indexMap[a] > _this._indexMap[b] ? a : b; })); var max = parseInt(Object.keys(this._indexMap).reduce(function (a, b) { return _this._indexMap[a] > _this._indexMap[b] ? a : b; }));
for (var idx = max; idx >= _entry.idx; idx--) { for (var idx = max; idx >= _entry.idx; idx--) {
this._indexMap[idx].idx = idx + 1; this._indexMap[idx].idx = idx + 1;

View File

@ -61,6 +61,9 @@ export class et2_dataview_controller
private _objectManager: any; private _objectManager: any;
// @todo remove it after finding a right fix
private _disable_autorefresh: boolean;
/** /**
* Constructor of the et2_dataview_controller, connects to the grid * Constructor of the et2_dataview_controller, connects to the grid
* callback. * callback.
@ -132,6 +135,20 @@ export class et2_dataview_controller
} }
} }
/**
* Enable or disable autorefresh
*
* disable_autorefresh is used to detect that we have active push in order to enable a fix for push
* on _insertDataRow function reindexing the _indexMap which is wrong for the full refresh.
*
* @param disabled
* @todo remove it after finding a right fix
*/
set_disable_autorefresh( disabled : boolean)
{
this._disable_autorefresh = disabled;
}
/** /**
* @param value is an object implementing the et2_IDataProvider * @param value is an object implementing the et2_IDataProvider
* interface * interface
@ -458,8 +475,9 @@ export class et2_dataview_controller
this._grid.insertRow(_entry.idx, _entry.row); this._grid.insertRow(_entry.idx, _entry.row);
} }
// Update index map //@todo remove it after finding a right fix
if(this._indexMap[_entry.idx].uid !== _entry.uid) // Update index map only for push (autorefresh disabled)
if(this._disable_autorefresh && this._indexMap[_entry.idx].uid !== _entry.uid)
{ {
let max = parseInt(Object.keys(this._indexMap).reduce((a, b) => this._indexMap[a] > this._indexMap[b] ? a : b)); let max = parseInt(Object.keys(this._indexMap).reduce((a, b) => this._indexMap[a] > this._indexMap[b] ? a : b));
for(let idx = max; idx >= _entry.idx; idx--) for(let idx = max; idx >= _entry.idx; idx--)

View File

@ -1238,7 +1238,7 @@ var et2_nextmatch = /** @class */ (function (_super) {
autoRefresh_1.set_id("nm_autorefresh"); autoRefresh_1.set_id("nm_autorefresh");
autoRefresh_1.set_select_options({ autoRefresh_1.set_select_options({
// Cause [unknown] problems with mail // Cause [unknown] problems with mail
//30: "30 seconds", 3: "30 seconds",
//60: "1 Minute", //60: "1 Minute",
180: "3 Minutes", 180: "3 Minutes",
300: "5 Minutes", 300: "5 Minutes",
@ -1539,6 +1539,8 @@ var et2_nextmatch = /** @class */ (function (_super) {
*/ */
et2_nextmatch.prototype.set_disable_autorefresh = function (disabled) { et2_nextmatch.prototype.set_disable_autorefresh = function (disabled) {
this.options.disable_autorefresh = disabled; this.options.disable_autorefresh = disabled;
//@todo remove it after finding a right fix
this.controller.set_disable_autorefresh(disabled);
this._set_autorefresh(this._get_autorefresh()); this._set_autorefresh(this._get_autorefresh());
}; };
/** /**

View File

@ -1738,7 +1738,7 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
autoRefresh.set_id("nm_autorefresh"); autoRefresh.set_id("nm_autorefresh");
autoRefresh.set_select_options({ autoRefresh.set_select_options({
// Cause [unknown] problems with mail // Cause [unknown] problems with mail
//30: "30 seconds", 3: "30 seconds",
//60: "1 Minute", //60: "1 Minute",
180: "3 Minutes", 180: "3 Minutes",
300: "5 Minutes", 300: "5 Minutes",
@ -2105,6 +2105,8 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
set_disable_autorefresh( disabled : boolean) set_disable_autorefresh( disabled : boolean)
{ {
this.options.disable_autorefresh = disabled; this.options.disable_autorefresh = disabled;
//@todo remove it after finding a right fix
this.controller.set_disable_autorefresh(disabled);
this._set_autorefresh(this._get_autorefresh()); this._set_autorefresh(this._get_autorefresh());
} }