Merge pull request #6447 from buinsky/master

WebUI: Improve performance of updating 'progress' column
This commit is contained in:
sledgehammer999 2017-03-05 14:46:30 +02:00 committed by GitHub
commit 922fec44d2

View file

@ -32,6 +32,7 @@
**************************************************************/
var DynamicTableHeaderContextMenuClass = null;
var ProgressColumnWidth = -1;
var DynamicTable = new Class({
@ -851,25 +852,34 @@ var TorrentsTable = new Class({
if (td.getChildren('div').length) {
var div = td.getChildren('div')[0];
var newWidth = td.offsetWidth - 5;
if (div.lastWidth !== newWidth) {
div.setWidth(newWidth);
div.lastWidth = newWidth;
if (td.resized) {
td.resized = false;
div.setWidth(ProgressColumnWidth - 5);
}
if (div.getValue() != progressFormated)
div.setValue(progressFormated);
}
else
else {
if (ProgressColumnWidth < 0)
ProgressColumnWidth = td.offsetWidth;
td.adopt(new ProgressBar(progressFormated.toFloat(), {
'width' : td.offsetWidth - 5
'width' : ProgressColumnWidth - 5
}));
td.resized = false;
}
};
this.columns['progress'].onResize = function (columnName) {
var pos = this.getColumnPos(columnName);
var trs = this.tableBody.getElements('tr');
for (var i = 0; i < trs.length; i++)
this.columns[columnName].updateTd(trs[i].getElements('td')[pos], this.rows.get(trs[i].rowId));
ProgressColumnWidth = -1;
for (var i = 0; i < trs.length; i++) {
var td = trs[i].getElements('td')[pos];
if (ProgressColumnWidth < 0)
ProgressColumnWidth = td.offsetWidth;
td.resized = true;
this.columns[columnName].updateTd(td, this.rows.get(trs[i].rowId));
}
}.bind(this);
// num_seeds